Exemplo n.º 1
0
        static void Main(string[] args)
        {
            delHandler d1 = Add;
            //Console.WriteLine(d1(3,4));

            delHandler d2 = delegate(int x, int y) { return(x + y); };
            //Console.WriteLine(d2(3,4));

            delHandler d3 = (x, y) => x + y;

            Console.WriteLine(d3(3, 4));
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            delHandler d1 = new delHandler(Add);
            //d1(3, 5);
            //Add(3, 5);

            class1     x  = new class1();
            delHandler d2 = new delHandler(x.Subtract);
            //d2(2, 6);
            //x.Subtract(2, 6);

            delHandler d3 = d1 + d2;

            d3(20, 4);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Register method
 /// </summary>
 /// <param name="method">Method name</param>
 /// <param name="handler">Method delegate</param>
 protected void Register(string method, delHandler handler)
 {
     Entries[method] = handler;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Register method
 /// </summary>
 /// <param name="method">Method name</param>
 /// <param name="synonymous">Synonymous</param>
 /// <param name="handler">Method delegate</param>
 protected void Register(string method, string synonymous, delHandler handler)
 {
     Entries[method]     = handler;
     Entries[synonymous] = handler;
 }