Delegate - simples

<< Click to Display Table of Contents >>

Navigation:  Início > Delegates >

Delegate - simples

Previous pageReturn to chapter overviewNext page

  public delegate void SimpleDelegate();

 

  class Program

   {

      public static void MyFunc()

       {

          Console.WriteLine("I was called by delegate ...");

       }

 

      public static void Main()

       {

          // Instantiation

          SimpleDelegate simpleDelegate = new SimpleDelegate(MyFunc);

 

          // Invocation

           simpleDelegate();

       }

   }