【发布时间】:2010-06-25 18:04:03
【问题描述】:
我想为冒泡排序实现一个委托解决方案。我有这个代码:
public delegate void SortHandler<T>(IList<T> t);
public static void Sort<T>(IList<T> arr, SortHandler<T> func)
{
func(arr);
}
int[] arr2 = { 10,1,2,3,4 };
CollectionHelper.Sort<int>(arr2, bubble_sort);
冒泡排序函数签名为:
static void bubble_sort(int[] array) {}
我收到此错误:
参数“2”:无法从“方法组”转换为“DelegatesAndGenerics.SortHandler”
【问题讨论】: