delegate void SomeDelegate();
OneInstance = new SomeDelegate(OneMethod);
{
//Do Something
}
delegate string B(int i);
B b = B(A); //A是一个int型常量
此时所委托的方法A 需要跟委托类型B的返回类型以及参数类型和个数都保持一致。
如:
string A(int i)
{
//Do Something;
return i.ToString();
}
C#委托
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M