Create a delegate by declaration : Anonymous delegate : Delegate C# Examples


C# Examples » Delegate » Anonymous delegate »

 

Create a delegate by declaration









    
using  System;
using  System.Collections.Generic;
using  System.Text;
class  Program  {
        delegate  string  delegateTest(string  val);

        static  void  Main(string[]  args)  {
                string  mid  =  ",  middle  part,";

                delegateTest  d  =  delegate(string  param)  {
                        param  +=  mid;
                        param  +=  "  and  this  was  added  to  the  string.";
                        return  param;
                };

                Console.WriteLine(d("Start  of  string"));

        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Delegate
» Anonymous delegate