1 public delegate void Print(string printStr); 2 public static void DelegateMethod(string printStr) 3 { 4 Console.WriteLine(printStr.Reverse().ToArray()); 5 } 6 7 static string ReverseString(string s) 8 { 9 return new string(s.Reverse().ToArray()); 10 } 11 static void Main(string[] args) 12 { 13 //旧方法 14 Print print = DelegateMethod; 15 print("a string"); 16 17 //新方法 18 Func<string, string> rev = ReverseString; 19 Console.WriteLine(rev("a string")); 20 //原始方法 21 Console.WriteLine(ReverseString("a string")); 22 23 Console.ReadKey(true); 24 }