Anonymous methods can be assigned a signature : delegate anonymous : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » delegate anonymous »

 

Anonymous methods can be assigned a signature








    
 

using System;
using System.Threading;


public delegate int DelegateClass(out int param);

public class Starter {
    public static void Main() {
        int var;
        DelegateClass del = delegate(out int inner) {
            inner = 12;
            Console.WriteLine("Running anonymous method");
            return inner;
        };
        del(out var);
        Console.WriteLine("Var is {0}", var);
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» delegate anonymous