标签:nbsp ini gate 参数 stat OLE 返回值 oid public
1、委托的声明
public delegate void ConsoleWrite(); //无参数无法回值
public delegate void ConsoleWriteStr(string name,DateTime now); //有参无返回值
public delegate int ConsoleWrite(int x,int y); //有参数有返回值的
2、委托的实例化
ConsoleWriteStr cws = new ConsoleWriteStr(Study); // 委托的实例化,要求方法的签名一致
//ConsoleWriteStr cws = Study;
3、委托的调用
cws.Invoke("wjl",DateTime.Now); // 委托的调用 cws("wjl",DateTime.Now) 这种调用方式也可以 ,异步调用 cws.BeginInvoke("wjl", DateTime.Now, null, null);
public static void Study(string name, DateTime now) {
Console.WriteLine("我叫{0},我喜欢学习{1}", name, now);
}
标签:nbsp ini gate 参数 stat OLE 返回值 oid public
原文地址:https://www.cnblogs.com/netlws/p/8893870.html