委托,就是一个能够表示方法的数据类型。
准备工作,写一个冒泡排序
public static void BubbleSort(int[] items,ComparisonHandler comparionsMethod) { int i; int j; int temp; if (items == null) return; if (comparionsMethod == null) throw new ArgumentNullException("comparionsMehtod"); for (i = items.Length – 1; i >= 0; i–) { for (j = 1; j <= i; j++) { if (comparionsMethod(items[j - 1], items[j])) { temp [...]
