Action type method can delegate 0-16 parameters, but not have a return value.
The method may delegate type Func parameter must have a return value.
Actoin use
the using the System; the using the System.Collections.Generic; the using the System.Linq; the using the System.Text; the using System.Threading.Tasks; namespace event { class Program { static void the Main ( String [] args) { the Action < int > del M2 = ; // function parameters delegate a del ( 10 ); the Action del1 = M1; // function parameters not delegate del1 (); the Action < int ,int > del2 = M3; // function delegate two parameters del2 ( 10 , 20 is ); the Console.ReadKey (); } static void M1 () { Console.WriteLine ( " M1 " ); } static void M2 ( int A) { Console.WriteLine (A); } static void M3 ( int A, int B) { Console.WriteLine ( " {0}, {}. 1 ",a,b); } } }
Func <parameters, return values> delegate use has to return
the using the System; the using the System.Collections.Generic; the using the System.Linq; the using the System.Text; the using System.Threading.Tasks; namespace event { class Program { static void the Main ( String [] args) { Func < int > = M1 Fun ; // delegate a method without parameters return value of type int Fun (); Func < int , string > = M2 fun1; // entrust a return value of type string, int parameter method fun1 ( 29); Console.ReadKey(); } static int m1() { return 10; } static string m2(int a) { return "string"; } } }