public DeligateMethods() { MyDeligate del = del1 + del2; del.Invoke("hello world!"); MyDeligateInt delInt = del3 + del4; Console.WriteLine(delInt()); }
static void Main(string[] args) { MyClass instance = new MyClass(); MyDeligate myDeligate = new MyDeligate(Sum); MyDeligate myDeligate1 = myDeligate + myDeligate; myDeligate1(); myDeligate.Invoke(); }
static void Main(string[] args) { //SingletonDemo gotInstance = SingletonDemo.getInstance(); SingletonDemo singletonDemo = new SingletonDemo(); MyDeligate myDeligate = new MyDeligate(singletonDemo.Sumation); int res = myDeligate(2, 3); Console.WriteLine(res.ToString()); }
static void Main(string[] args) { MyDeligate <int> ob = new MyDeligate <int>(sqr); Console.WriteLine("Square is: {0}", ob(5)); ob = new MyDeligate <int>(cube); Console.WriteLine("Cube is: {0}", ob(5)); ob = new MyDeligate <int>(fact); Console.WriteLine("Factorial is: {0}", ob(5)); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); Program p = new Program(); //MyDeligate del = new MyDeligate(p.add); //del.Invoke(2, 3); //MyDeligate del2 = new MyDeligate(Program.mul); //del2(3, 4); MyDeligate del = null; del += p.add; del += Program.mul; del.Invoke(5, 2); }