Pass integer by ref : Method Parameter : Class C# Examples


C# Examples » Class » Method Parameter »

 

Pass integer by ref









    
using  System;

class  MainClass
{
    static  void  Main(string[]  args)
    {
            int  MyInt  =  5;

        MyMethodRef(ref  MyInt);
      
                Console.WriteLine(MyInt);
    }
    
    static  public  int  MyMethodRef(ref  int  myInt)
    {
        myInt  =  myInt  +  myInt;
        return  myInt;
    }
}
    
   
  
   



Output

10


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Method Parameter