Fixing Managed Data in Memory : Unsafe Code : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » Unsafe Code »

 

Fixing Managed Data in Memory








    


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







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» Unsafe Code