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

This interface is the counterpart to IListSource{T} for lists whose minimum index is not (necessarily) zero. More...


Source file:
Inheritance diagram for Loyc.Collections.INegListSource< out T >:
Loyc.Collections.ITryGet< in K, out V > Loyc.Collections.IIndexed< in K, out V > Loyc.Collections.INegArray< T > Loyc.Collections.NegListSlice< T > Loyc.Collections.NegListSource< T > Loyc.Collections.IAutoNegArray< T > Loyc.Collections.INegAutoSizeArray< T > Loyc.Collections.INegDeque< T > Loyc.Collections.NegList< T > Loyc.Collections.InternalDArray< T >

Remarks

This interface is the counterpart to IListSource{T} for lists whose minimum index is not (necessarily) zero.

Be careful not to write a loop that relies on ICount.Count or starts at zero! You must always loop from Min to Max, like so:

for (int i = list.Min; i &lt;= list.Max; i++) { ... }

Properties

int Min [get]
 Returns the minimum valid index in the collection. More...
 
int Max [get]
 Returns the maximum valid index in the collection. More...
 
- Properties inherited from Loyc.Collections.IIndexed< in K, out V >
this[K key] [get]
 Gets the value associated with the specified key. More...
 

Public Member Functions

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...
 

Member Function Documentation

IListSource<T> Loyc.Collections.INegListSource< out T >.Slice ( int  start,
int  count = int.MaxValue 
)

Property Documentation

int Loyc.Collections.INegListSource< out T >.Max
get

Returns the maximum valid index in the collection.

Count must equal Max-Min+1. If Count is 0, Max = Min-1

int Loyc.Collections.INegListSource< out T >.Min
get

Returns the minimum valid index in the collection.