权力的游戏第七季第一集下载,hb商店,安闲自得的意思
public delegate int32 computedelegate(int32 a, int32 b); private static int32 compute(int32 a, int32 b) { return a + b; } public delegate int32 computedelegate2(int32 a, int32 b); //delegate参数 private static int32 receivedelegateargsfunc(computedelegate2 func) { return func(1, 2); } private static int32 delegatefunction(int32 a, int32 b) { return a + b; }
public static void testaction<t>(action<t> action, t t) { action(t); } private static void printf(string s) { console.writeline($"3、{s}"); } private static void printf(int s) { console.writeline($"3、{s}"); }
public static int testfunc<t1, t2>(func<t1, t2, int> func, t1 a, t2 b) { return func(a, b); } private static int fun(int a, int b) { return a + b; }
private static bool productgt10(point p) { if (p.x * p.y > 100000) { return true; } else { return false; } }
expression<func<int, int, int, int>> expr = (x, y, z) => (x + y) / z;
public computedelegate ondelegate; public void cleardelegate() { while (ondelegate != null) { ondelegate -= ondelegate; } }
static void main(string[] args) { program2 test = new program2(); if (test.ondelegate != null) { delegate[] dels = test.ondelegate.getinvocationlist(); for (int i = 0; i < dels.length; i++) { test.ondelegate -= dels[i] as computedelegate; } } }
static void main(string[] args) { computedelegate computedelegate = new computedelegate(compute); console.writeline($"1、sum:{computedelegate(1, 2)}"); computedelegate2 computedelegate2 = new computedelegate2(delegatefunction); console.writeline($"2、sum:{receivedelegateargsfunc(computedelegate2)}"); testaction<string>(printf, "action"); testaction<int32>(printf, 12); testaction<string>(x => { printf(x); }, "hello action!");//lambda console.writeline($"4、{ testfunc(fun, 1, 2)}"); point[] points = { new point(100, 200), new point(150, 250), new point(250, 375), new point(275, 395), new point(295, 450) }; point first = array.find(points, productgt10); console.writeline($"5、 x = {first.x}, y = {first.y}"); expression<func<int, int, int, int>> expr = (x, y, z) => (x + y) / z; console.writeline($"6、{expr.compile()(1, 2, 3)}"); console.writeline("press any key..."); console.readkey(); }
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论