Enhanced C#
Language of your choice: library documentation
|
Adapter: Provides access to a section of an array. More...
Adapter: Provides access to a section of an array.
Public fields | |
T[] | _list |
int | _start |
int | _count |
Properties | |
int | Count [get] |
bool | IsEmpty [get] |
T | First [get, set] |
T | Last [get, set] |
T | this[int index] [get, set] |
T | this[int index, T defaultValue] [get] |
T[] | InternalList [get] |
Returns the original array. More... | |
int | InternalStart [get] |
int | InternalStop [get] |
Properties inherited from Loyc.Collections.IMRange< T > | |
new T | this[int index] [get, set] |
Properties inherited from Loyc.Collections.IMBRange< T > | |
new T | Last [get, set] |
Gets or sets the value of the last item in the range. More... | |
Properties inherited from Loyc.Collections.IBRange< T > | |
T | Last [get] |
Returns the value of the last item in the range. More... | |
Properties inherited from Loyc.Collections.IMFRange< T > | |
new T | First [get, set] |
Gets or sets the value of the first item in the range. More... | |
Properties inherited from Loyc.Collections.IFRange< T > | |
T | First [get] |
Returns the first value in the range, without popping it. More... | |
Properties inherited from Loyc.Collections.IIsEmpty | |
bool | IsEmpty [get] |
Public Member Functions | |
ArraySlice (T[] list, int start, int count) | |
Initializes an array slice. More... | |
ArraySlice (T[] list) | |
T | PopFirst (out bool empty) |
T | PopLast (out bool empty) |
IFRange< T > ICloneable< IFRange< T > >. | Clone () |
IBRange< T > ICloneable< IBRange< T > >. | Clone () |
IRange< T > ICloneable< IRange< T > >. | Clone () |
ArraySlice< T > ICloneable< ArraySlice< T > >. | Clone () |
IEnumerator< T > IEnumerable< T >. | GetEnumerator () |
System.Collections.IEnumerator System.Collections.IEnumerable. | GetEnumerator () |
InternalList.Enumerator< T > | GetEnumerator () |
T | TryGet (int index, out bool fail) |
IRange< T > IListSource< T >. | Slice (int start, int count) |
ArraySlice< T > | Slice (int start, int count=int.MaxValue) |
T[] | ToArray () |
Public Member Functions inherited from Loyc.Collections.IBRange< T > | |
T | PopLast (out bool fail) |
Removes the last item from the range and returns it. More... | |
Public Member Functions inherited from Loyc.Collections.IFRange< T > | |
T | PopFirst (out bool fail) |
Removes the first item from the range and returns it. More... | |
Static Public Member Functions | |
static implicit | operator ArraySlice< T > (T[] array) |
|
inline |
Initializes an array slice.
ArgumentException | The start index was below zero. |
The (start, count) range is allowed to be invalid, as long as 'start' is zero or above.
list.Length - start
.
|
get |
Returns the original array.
Ideally, to protect the array there would be no way to access its contents beyond the boundaries of the slice. However, the reality in .NET today is that many methods accept "slices" in the form of a triple (list, start index, count). In order to call such an old-style API using a slice, one must be able to extract the internal list and start index values.