C# Lambda表达式、匿名、回调

delegate void myTestDeletage (string name , int age); 

void Start() { 

    SetMsg("HFF",28); 

void SetMsg(string name, int age) 

    Print(name, age, (str, i) => {Debug.Log("Name is :" + str + " Age is : " + i); }); 

void Print(string s,int i,myTestDeletage mDelegate) 

{

 Debug.Log("Print : " + s);

 mDelegate(s,i); 

}


/**************/输出结果:

Print : HFF

Name is :HFF Age is : 28

你可能感兴趣的:(Unity3D)