static void Main(string[] args) { Functional functional = new Functional(MethodF); Delegate3 delegate3 = functional.Invoke(new Delegate1(Method1), new Delegate2(Method2)); Console.WriteLine(delegate3.Invoke()); }
static void Main(string[] args) { Functional functional = new Functional(MethodF); Delegate3 delegat3 = functional(Method1, Method2); Console.WriteLine(delegat3.Invoke()); Console.ReadKey(); }
static void Main() { // Enable Unicode Console.OutputEncoding = Encoding.Unicode; Functional functional = new Functional(MethodF); Delegate3 delegate3 = functional.Invoke(new Delegate1(Method1), new Delegate2(Method2)); Console.WriteLine(delegate3.Invoke()); // Delay. Console.ReadKey(); }
static void Main(string[] args) { Delegate1 obj1 = AddNums1; //or new DelegatesProj.Delegate1(AddNums1); double result = obj1.Invoke(100, 34.2f, 129.221); Console.WriteLine(result); Delegate2 obj2 = AddNums2; obj2.Invoke(100, 32.2f, 129.221); Delegate3 obj3 = CheckLength; bool status = obj3.Invoke("Hello World"); Console.WriteLine(status); Console.ReadLine(); }
static void Main() { Functional functional = new Functional(Method); Delegate1 delegate1 = new Delegate1(Method1); Delegate2 delegate2 = new Delegate2(Method2); Delegate3 delegate3 = functional.Invoke(delegate1, delegate2); //или //Delegate3 delegate3 = functional.Invoke(new Delegate1(Method1), new Delegate2(Method2)); Console.WriteLine(delegate3.Invoke()); Console.WriteLine(new string('-', 10)); Console.WriteLine(delegate3()); Console.ReadKey(); }