Enhanced C#
Language of your choice: library documentation
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.IListSource< T > Loyc.Collections.IListSink< T > Loyc.Collections.IListAndReadOnly< T > Loyc.Collections.ICollectionAndReadOnly< T >

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

- Public Member Functions inherited from Loyc.Collections.IListSource< T >
IRange< T > Slice (int start, int count=int.MaxValue)
 Returns a sub-range of this list. More...