草庐IT

DictionaryComparer

全部标签

c# - 为什么这段代码会提示 "the arity of the generic type definition"?

我有一个通用类型:classDictionaryComparer:IEqualityComparer>还有一个工厂方法,它将(应该)为给定的字典类型创建此类的实例。privatestaticIEqualityComparerCreateDictionaryComparer(){Typedef=typeof(DictionaryComparer);Debug.Assert(typeof(T).IsGenericType);Debug.Assert(typeof(T).GetGenericArguments().Length==2);Typet=def.MakeGenericType(ty