在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
static void Main(string[] args) { //Action TestAction<string>(Action, "Hello"); TestAction<int>(Action, 1000); TestAction<string>(p => { Console.WriteLine(p); }, "Lamada"); //Func int result = TestFunc<int, int>((t1, t2) => { return t1 + t2; }, 2, 6); Console.WriteLine(result); //predicate List<int> list = new List<int>() { 1, 2, 3, 4, 5, 6 }; Predicate<int> pre = delegate(int num) { return num > 3; }; list.FindAll(pre).ForEach(n => { Console.WriteLine(n); }); Console.ReadKey(); } static void TestAction<T>(Action<T> action, T p) { action(p); } private static void Action(string s) { Console.WriteLine(s); } private static void Action(int s) { Console.WriteLine(s); } static int TestFunc<T1, T2>(Func<T1, T2, int> func, T1 t1, T2 t2) { return func(t1, t2); }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论