-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
This issue is to add built-in support for specific collections including:
System.Collections.Generic
-
IEnumerable<T> -
ICollection<T> -
IList<T> -
IReadOnlyCollection<T> -
IReadOnlyList<T> -
ISet<T> -
Stack<T> -
Queue<T> -
HashSet<T> -
LinkedList<T> -
SortedSet<T> -
SortedDictionary<TKey, TValue> -
KeyValuePair<TKey, TValue>
Future KeyedByCollection<TItem>, LinkedListNode<T>, SynchronizedCollection<T>, SynchronizedKeyCollection<K, T>, SynchronizedReadOnlyCollection<T>
Sytem.Collections
-
IEnumerable -
ICollection -
IList -
IDictionary -
Stack -
Queue -
Hashtable -
ArrayList -
SortedList
Future: BitArray
System.Collections.Immutable
-
IImmutableList<T> -
IImmutableQueue<T> -
IImmutableSet<T> -
IImmutableStack<T> -
IImmutableDictionary<TKey, TValue> -
ImmutableArray<T> -
ImmutableHashSet<T> -
ImmutableList<T> -
ImmutableQueue<T> -
ImmutableSortedSet<T> -
ImmutableStack<T> -
ImmutableDictionary<TKey, TValue> -
ImmutableSortedDictionary<TKey, TValue>
It should leverage the extensibility support for IEnumerable and register these interfaces.
Design notes:
- No new public APIs are needed.
2) The instance returned should only implement the specific interface. It should not be possible to cast to our implementation. This ensures we can change the type later if necessary and prevents other general misuses.
For example, the likely implementation for IEnumerable<T> is an internal class that implements IEnumerable<T> where the only public members are those used to implement IEnumerable<T>. The internal class then forwards each IEnumerable<T> member call to an instance of List<T> which is stored in a private field and thus not accessible publically and not castable to List<T> or other interfaces like IList<T>.
- We may want to also provide default implementations of some non-interfaces as well pending feedback (for example
System.Collections.Immutable.ImmutableArray)
UPDATE
Also support System.Collections.Immutable and System.Collections.Generic (actual list TBD). These are not interfaces, but the same mechanism can be used to support them.