1:定义一个委托,int是委托的函数的返回值类型,如果是void就写void
public delegate int ListenServerDelegate();
2:创建一个委托,GetServerList是函数
ListenServerDelegate listenServerDelegate = new ListenServerDelegate(GetServerList);
3:开始执行委托的函数,str是GetServerList的参数,如果无参就不写
this.BeginInvoke(listenServerDelegate, new object[] { str });
4:
public int GetServerList(string str) { return Int i=1;}