static void Main(string[] args) { Console.Write("*****************************************Multiplication of two number**************************************"); Console.Write("Enter first number :"); int num1 = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter second number :"); int num2 = Convert.ToInt32(Console.ReadLine()); delegateExample del = new delegateExample(mul); del(num1, num2); AnnonymousDel del2 = delegate(int val1, int val2) { Console.WriteLine("Output using Annonymous Methord : " + (val1 * val2)); }; del2(num1, num2); LambdaDel lDel = (int val1, int val2) => { Console.WriteLine("Output using Lambda expression is :" + val1 * val2); }; lDel(num1, num2); Console.ReadKey(); }
public static void Main(string [] args) { CallingPrivateMethodsThroughDelegates c = new CallingPrivateMethodsThroughDelegates(); delegateExample d = new delegateExample(c.privateMethod); }
public static void Main (string [] args) { CallingPrivateMethodsThroughDelegates c = new CallingPrivateMethodsThroughDelegates (); delegateExample d = new delegateExample (c.privateMethod); }