Use out to mark an object parameter : Function Parameters : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » Function Parameters »

 

Use out to mark an object parameter








    
 

using System;

class XInt {

    public int iField = 5;
}

class Starter {

    public static void MethodA(out XInt alias) {
        XInt inner = new XInt();
        alias = inner;
    }

    public static void Main() {
        XInt obj;
        MethodA(out obj);
        Console.WriteLine(obj.iField); // 5
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» Function Parameters