ref pointer parameter : Function Parameters : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » Function Parameters »

 

ref pointer parameter








    
 

using System;

public class Starter {

    public unsafe static void Main() {
        int val = 5;
        int* pA = &val;
        Console.WriteLine("Original: {0}", (int)pA);
        MethodA(pA);
        Console.WriteLine("MethodA:  {0}", (int)pA);
        MethodB(ref pA);
        Console.WriteLine("MethodB:  {0}", (int)pA);
    }

    public unsafe static void MethodA(int* pArg) {
        ++pArg;
    }

    public unsafe static void MethodB(ref int* pArg) {
        ++pArg;
    }

}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» Function Parameters