public static void Main() { wd matha = a => { int fact = 0; for (int i = a; i > 0; i--) { if (i == a) { fact = i; } else { fact *= i; } } return(fact); }; matha += a => { int r = a * a; int r1 = r * a; return(r1); }; matha += a => a * a; foreach (wd m in matha.GetInvocationList()) { Console.WriteLine(m.Method + " " + m.Invoke(3)); } Console.ReadLine(); }
public static void Main() { wd matha = new wd(math.factorial); matha += new wd(math.cube); matha += new wd(math.square); foreach (wd m in matha.GetInvocationList()) { Console.WriteLine(m.Method + " " + m.Invoke(3)); } Console.ReadLine(); }
public static void Main() { anno a = new anno(); wd evt = a.fact; evt += a.sqr; evt += a.cube; foreach (wd m in evt.GetInvocationList()) { Console.WriteLine(m.Method + " " + m.Invoke(3)); } Console.ReadLine(); }
public static void Main() { math math = new math(); //-----------create instance of math class wd matha = new wd(math.factorial); //---------assign handler by instance matha += new wd(math.cube); matha += new wd(math.square); foreach (wd m in matha.GetInvocationList()) { Console.WriteLine(m.Method + " " + m.Invoke(3)); } Console.ReadLine(); }