Enhanced C#
Language of your choice: library documentation
Public fields | Properties | Public Member Functions | List of all members
Loyc.Collections.ROLSlice< TList, T > Struct Template Reference

Adapter: a random-access range for a slice of an IReadOnlyList<T>. More...


Source file:
Inheritance diagram for Loyc.Collections.ROLSlice< TList, T >:
Loyc.Collections.IListSource< T > Loyc.Collections.IRange< T >

Remarks

Adapter: a random-access range for a slice of an IReadOnlyList<T>.

Template Parameters
TItem type in the list
TListList type
Type Constraints
TList :IReadOnlyList<T> 

Public fields

TList _list
 
int _start
 
int _count
 

Properties

int Count [get]
 
bool IsEmpty [get]
 
First [get]
 
Last [get]
 
this[int index] [get]
 
this[int index, T defaultValue] [get]
 

Public Member Functions

 ROLSlice (TList list, int start, int count=int.MaxValue)
 Initializes a slice. More...
 
 ROLSlice (TList list)
 
PopFirst (out bool empty)
 
PopLast (out bool empty)
 
ROLSlice< TList, T > ICloneable< ROLSlice< TList, T > >. Clone ()
 
IRange< T > ICloneable< IRange< T > >. Clone ()
 
IFRange< T > ICloneable< IFRange< T > >. Clone ()
 
IBRange< T > ICloneable< IBRange< T > >. Clone ()
 
IEnumerator< T > IEnumerable< T >. GetEnumerator ()
 
System.Collections.IEnumerator System.Collections.IEnumerable. GetEnumerator ()
 
RangeEnumerator< ROLSlice< TList, T >, T > GetEnumerator ()
 
TryGet (int index, out bool fail)
 
IRange< T > IListSource< T >. Slice (int start, int count)
 
ROLSlice< TList, T > Slice (int start, int count=int.MaxValue)
 
- 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...
 

Constructor & Destructor Documentation

◆ ROLSlice()

Loyc.Collections.ROLSlice< TList, T >.ROLSlice ( TList  list,
int  start,
int  count = int.MaxValue 
)
inline

Initializes a slice.

Exceptions
ArgumentExceptionThe start index was below zero.

The (start, count) range is allowed to be invalid, as long as 'start' and 'count' are zero or above.

  • If 'start' is above the original Count, the Count of the new slice is set to zero.
  • if (start + count) is above the original Count, the Count of the new slice is reduced to list.Count - start.