【Delegate】委托
public delegate void myDelegate(string str);
public static void HellowChinese(string strChinese)
{
Console.WriteLine(“Good morning,” + strChinese);
Console.ReadLine();
}
myDelegate d = new myDelegate(HellowChinese);
d(“ZLL”);
【action<>】指定那些只有输入参数,没有返回值的委托
public static void HellowChinese(string strChinese)
{
Console.WriteLine(“Good morning,” + strChinese);
Console.ReadLine();
}
Action action = HellowChinese;
action(“ZLL”);
【func<>】这个和上面的那个是一样的,区别是这个有返回值!
public static string HelloEnglish(string strEnglish)
{
return “Hello.” + strEnglish;
}
Func
Console.WriteLine(f(“Srping ji”));
Console.ReadLine();



