static void Main(string[] args) { // Normal Methos Call getName("By Normal Method call - Abhishek Singh "); //Method Call using delegates myTestDel del = new myTestDel(getName); del("By Delagete call-Abhishek singh"); del.Invoke(" Using Invoke - Abhishek Singh "); del = new myTestDel(getLocation); del.Invoke("India"); myTestDel1 del1 = new myTestDel1(getLocation1); del1("Mumbai"); Console.ReadLine(); }
static void Main(string[] args) { // Normal Methos Call getName("By Normal Method call - Abhishek Singh "); //Method Call using delegates myTestDel del = new myTestDel(getName); del("By Delagete call-Abhishek singh"); del.Invoke(" Using Invoke - Abhishek Singh "); del = new myTestDel(getLocation); del("Mumbai"); // Mutlticast implementation with void return type TestMutliCast delmultiCast = new TestMutliCast(Method1); delmultiCast += Method2; delmultiCast(); // Mutlticast implementation with void return type myTestDel testMulti = new myTestDel(getName); testMulti += getLocation; testMulti("Abhi"); // Mutlticast implementation with int return type TestMutliCastint intMulti = new TestMutliCastint(Method3); intMulti += Method4; int i = intMulti(); Console.WriteLine("Return Value is " + i); Console.ReadLine(); }