标签:
1 class Program 2 { 3 static void Main(string[] args) 4 { 5 int[] intA = { 1, 3, 5, 7 }; 6 ProcArray(intA, AddOne); 7 foreach (int i in intA) 8 { 9 Console.Write(i + " "); 10 } 11 12 Console.ReadKey(); 13 } 14 private static void ProcArray(int[] intArra, ProcIntArrayHandler procHandler) 15 { 16 for (int i = 0; i < intArra.Length; i++) 17 { 18 intArra[i] = procHandler(intArra[i]); 19 } 20 } 21 22 private static int AddOne(int procNum) 23 { 24 return procNum + 1; 25 } 26 private static int AddTwo(int procNum) 27 { 28 return procNum + 2; 29 } 30 } 31 public delegate int ProcIntArrayHandler(int procNum);
委托
标签:
原文地址:http://www.cnblogs.com/kungge/p/4787721.html