//http://www.cnblogs.com/JeffreySun/archive/2012/11/14/2770211.html//http://www.baqima.com/a/2628.html//http://www.cnblogs.com/yangqi/archive/2010/07/16/1778767.html//http://www.cnblogs.com/TianFang/p/3928172.htmlusingSystem;usingSystem.Threading;namespacedemo{ Public DelegateT3 mydelegate<t1, T2, t3>(T1 t1, T2 T2); InterfaceMyinteface<t1, T2, t3>{T1 DoIT (T2 T2, T3 T3); } Public classMyclass<t1, T2, t3>: Myinteface<t1, T2, t3> { PublicT1 DoIT (T2 T2, T3 T3) {//throw new NotImplementedException ();T1 t1=default(T1); returnT1; } } //Primary Constructor//Public class User (string name, string password) {} Public classDemo {Private Static ReadOnly floatKaifaqu_wuyefei =18.8f; Public Static floatPay (intPeoplecount,stringFamily) { floatresult = Peoplecount *Kaifaqu_wuyefei; Console.WriteLine ($"faimily:{family} pay fee {RESULT:C}"); returnresult; } Static voidSwap<t> (refT T1,refT T2) {T temp=T1; T1=T2; T2=temp; } Public Static voidMain () {String str1="ABC", str2 ="EFG"; Swap<String> (refSTR1,refstr2); Console.WriteLine ($"{STR1}\T{STR2}"); MyDelegate<int32, String,float> Famxu =NewMydelegate<int32, String,float>(pay); MyDelegate<int32,string,float> Famliujie =Demo.pay; floatMoneyxu = Famxu (4,"XU Minghui"); floatMoenyliu = Famliujie (3,"Liujie"); //myclass<float,int,string> My =Newmyclass<float,int,string>(); floatMoneymu = My. DoIT (3,"Mu Jingyu"); Console.readkey (); } }}
C # generic proxy, generic interface, generic type, generic method