我寫什麼而不是???????選擇適當的過載?如何在c#中引用適當的非泛型重載?
using System;
using System.Collections.Generic;
namespace ConsoleApplication2
{
class A {}
class B : A {}
class C : A {}
class Program
{
static void Main(string[] args)
{
var l1 = new List<C>();
var l2 = new List<C>();
Comparer<C>(l1, l2, ???????);
}
void Compare(C a, C b) { }
void Compare(B a, B b) {}
void Compare<T>(IList<T> a, IList<T> b, Action<T,T> comparator)
{
for (int i = 0; i < a.Count; i++)
comparator(a[i], b[i]);
}
}
}
謝謝,我的壞! – UserControl 2009-07-24 06:15:54