我正在尝试解决编译器警告:
Type parameter 'TKey' has the same name as the type parameter from outer type 'Common.Core.ObservableDictionary<TKey,TValue>'
这是有问题的代码:
protected class KeyedDictionaryEntryCollection<TKey> : KeyedCollection<TKey, DictionaryEntry> {
public KeyedDictionaryEntryCollection() {}
public KeyedDictionaryEntryCollection(IEqualityComparer<TKey> comparer) : base(comparer) {}
protected override TKey GetKeyForItem(DictionaryEntry entry) {
return (TKey) entry.Key;
}
}
它显示了第一个 TKey 是问题。
我该如何解决这个问题?代码工作得很好,但我正在努力解决所有编译器警告。