Fixing Managed Data in Memory : IntPtr : Unsafe C# Examples


C# Examples » Unsafe » IntPtr »

 

Fixing Managed Data in Memory









    
using  System;
      
public  class  MyClass
{
        public  unsafe  static  void  Main()
        {
                int  ArrayIndex;
                int  []  IntegerArray;
      
                IntegerArray  =  new  int  [5];
                fixed(int  *  IntegerPointer  =  IntegerArray)
                {
                        for(ArrayIndex  =  0;  ArrayIndex  <  5;  ArrayIndex++)
                                IntegerPointer[ArrayIndex]  =  ArrayIndex;
                }
                for(ArrayIndex  =  0;  ArrayIndex  <  5;  ArrayIndex++)
                        Console.WriteLine(IntegerArray[ArrayIndex]);
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Unsafe
» IntPtr