日期:2014-05-18  浏览次数:20710 次

如果让一个方法支持泛型?
方法:Test(参数A),参数A,可能是Dictionary<int,int>,也可能是Dictionary<stirng,string>或Dictionary<int,string>

该怎么做?Test(Dictionary<T,T> D)不行,编译不过。Test(Dictionary<TKey,TValue> D)也不行。

------解决方案--------------------
private void Test<TKey,TValue>(IDictionary<TKey, TValue> tIDictionary)


}