Enhanced C#
Loyc library documentation
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
List of all members
Loyc.Collections.IListImpl< T > Interface Template Reference

This interface is intended to be implemented by all Loyc collections that implement IList{T}. It combines the original IList{T} interface with its component interfaces IReadOnlyList{T} and IListSink{T}, plus a little bit of additional functionality in IListSource{T}. More...


Source file:
Inheritance diagram for Loyc.Collections.IListImpl< T >:
Loyc.Collections.IListAndListSource< T > Loyc.Collections.IListSink< in T > Loyc.Collections.ICollectionImpl< T > Loyc.Collections.ICollectionAndReadOnly< T > Loyc.Collections.ICollectionSink< in T > Loyc.Collections.ICollectionSource< T > Loyc.Collections.IArraySink< in T > Loyc.Collections.ICollectionSink< in T > Loyc.Collections.ICollectionAndSource< T > Loyc.Collections.IListSource< out T > Loyc.Collections.IListAndReadOnly< T > Loyc.Collections.Impl.ListSourceBase< T > Loyc.Collections.BufferedSequence< T > Loyc.Collections.Impl.ListExBase< T > Loyc.Collections.ListSourceAsSparse< T > Loyc.Collections.ReversedListSource< T > Loyc.Collections.BufferedSequence< T >.Scanner

Remarks

This interface is intended to be implemented by all Loyc collections that implement IList{T}. It combines the original IList{T} interface with its component interfaces IReadOnlyList{T} and IListSink{T}, plus a little bit of additional functionality in IListSource{T}.

Unfortunately, as far as the C# compiler is concerned, IList{T} and IReadOnlyList{T} are unrelated, which causes problems.

This interface is not meant to be used as a variable type. It exists mainly to avoid ambiguity errors when invoking overloaded methods in plain C#. For example, there is a TryGet() extension method for IList{T} and an identical TryGet() method for IListSource{T}. To prevent the C# compiler from giving an ambiguity error when you try to call TryGet(),

Ironically, however, if you actually try to use the list through this interface you'll tend to get errors. For instance, both IList{T} and IReadOnlyList{T} have an indexer, so using the indexer in this interface is ambiguous. Therefore, variables should not have this type (except parameters to disambiguation methods, in which case the parameter is immediately casted to another type).

Additional Inherited Members

- Properties inherited from Loyc.Collections.ISource< out T >
new int Count [get]
 Gets the number of items in the collection. More...
 
- Properties inherited from Loyc.Collections.ICount
int Count [get]
 Gets the number of items in the collection. More...
 
- Properties inherited from Loyc.Collections.IIsEmpty
bool IsEmpty [get]
 
- Properties inherited from Loyc.Collections.IIndexed< in K, out V >
this[K key] [get]
 Gets the value associated with the specified key. More...
 
- Properties inherited from Loyc.Collections.IArraySink< in T >
this[int index] [set]
 
- Public Member Functions inherited from Loyc.Collections.IListSource< out T >
IListSource< T > Slice (int start, int count=int.MaxValue)
 Returns a sub-range of this list. More...
 
- Public Member Functions inherited from Loyc.Collections.ITryGet< in K, out V >
TryGet (K key, out bool fail)
 Gets the item for the specified key or index, and does not throw an exception on failure. More...
 
- Public Member Functions inherited from Loyc.Collections.ICollectionSource< T >
void CopyTo (T[] array, int arrayIndex)
 Copies the elements of the collection to an Array, starting at a particular array index. More...
 
- Public Member Functions inherited from Loyc.Collections.IContains< in T >
bool Contains (T item)
 Returns true if and only if the collection contains the specified item. More...
 
- Public Member Functions inherited from Loyc.Collections.ICollectionSink< in T >
void Clear ()
 
bool Remove (T item)
 
- Public Member Functions inherited from Loyc.Collections.IAdd< in T >
void Add (T item)