The action and Func generic delegates are actually a. NET framework predefined delegate, which is an attribute introduced by 3.5. Basically covers all commonly used delegates, so it is generally not necessary to re-declare them.
The action series generic delegate, which is a delegate with no parameters returned, can have up to 16 arguments or no arguments; the Func series delegate is a delegate with a return value and can have up to 16 parameters;
Tuples are a new feature introduced in C # 4.0, which needs to be written based on the. NET Framework 4.0 or later. Tuples use generics to simplify the definition of a class.
Provides a static method for creating a tuple object. You can provide up to 8 tuples, or eight tuples, to create a new set.
Action
Public Delegate void Action ()
//void Method ();Action test1 = () = {Console.WriteLine ("void Method ();"); };//void Method (x);action<int> test2 = (x) = = {Console.WriteLine ("void Method (T1)"); };//void Method (x, y);action<int,int> test3 = (x, y) = = {Console.WriteLine ("void method (T1, T2)"); };
Public Delegate void action<in (in) in in in in T16> ()
Func
Public Delegate TResult func< out tresult> ()
// int method (); func<intten; // int method (x); func<intint2; // int method (X,X); func<intint int > TEST6 = (x, y) + x * y;
Public Delegate TResult func<in in in in in out Tresult> ()
Tuple
Public Static Tuple<t1> create<t1>( T1 item1)var tuple1 = tuple.create (1); Console.WriteLine (Tuple1. ITEM1); // Displays 1 var New tuple<int> (1); Console.WriteLine (Tuple1. ITEM1); // Displays 1
Tuple.create<t1, T2, T3, T4, T5, T6, T7, t8>methods (T1, T2, T3, T4, T5, T6 , T7, T8)varPrimes =Newtuple<int,int,int,int,int,int,int, Tuple<int>> (1,2,3,4,5,6,7,Newtuple<int> (8));//The progenitor can be nested inside the yuan
tuple<int,int,int,int,int,int,int, tuple<int,int,int>> test =
Newtuple<int,int,int,int,int,int,int, tuple<int,int,int>> (1,2,3,4,5,6,7,Newtuple<int,int,int> (8,9));
Ganso accurate can be said to have multiple return values of a method, without the use of ref,out, more convenient.
C # Advanced Features (iii) Action, func,tuple