mark method as unsafe : Unsafe Code : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » Unsafe Code »

 

mark method as unsafe








    
 

class FixedArrayApp
{
    unsafe public static void Foo(int* pa)
    {
        for (int* ip = pa; ip < (pa+5); ip++)
        {
            Console.Write("{0,-3}", *ip);
        }
    }
   
    static void Main(string[] args)
    {
        int[] ia = new int[5]{12,34,56,78,90};
   
        unsafe
        {
            fixed (int* pa = ia)
            {
                Foo(pa);
            }
        }
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» Unsafe Code