•委派返回值为其函数列表中最后一个调用的返回值,不过一般我们不会去关心它。
简单示例如下:
#region Using directives
简单示例如下:
#region Using directives
•using System;
•using System.Collections.Generic;
•using System.Text;
•#endregion
•namespace ConsoleApplication3
•{
• class Program
• {
• delegate string DelegateTest(string input);
• static void Main(string[] args)
• {
• DelegateTest din = new DelegateTest(Test1);
• din += new DelegateTest(Test2);
• string rlt = din("123");
• Console.WriteLine(rlt);
• Console.ReadLine();
• }
• static string Test1(string inp)
• {
• Console.WriteLine("Test1");
• return "test1";
• }
• static string Test2(string inp)
• {
• Console.WriteLine("Test2");
• return "test2";
• }
• }
•}
浙公网安备 33010602011771号