Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
C# 是否有一个可由泛型类型索引的数组类型(显然是一种约束IComparable或类似的类型)?例如:
IComparable
public class GenericallyIndexedArray<I,T> where I : struct, IComparable { // ...
秩序很重要。
是的,它是SortedList<TKey, TValue>
SortedList<TKey, TValue>
您可以IComparer<T>为键提供要使用的值,或者如果键类型实现它,则使用默认值。
IComparer<T>