Class Leap::Unity::SliceExtensions

class Leap.Unity.SliceExtensions

Public Static Functions

static Slice<T> Slice<T> (this IList<T> list, int beginIdx = -1, int endIdx = -1)

Creates a slice into the List with an inclusive beginIdx and an exclusive endIdx. A slice with identical begin and end indices would be an empty slice.

A slice whose endIdx is smaller than its beginIdx will index backwards along the underlying List.

Not providing either index argument will simply refer to the beginning of the list (for beginIdx) or to the end of the list (for endIdx).

Slices do not allocate, and they provide an enumerator definition so they can be used in a foreach statement.

static T[] ToArray<T> (this Slice<T> slice)

Creates a new array and returns it, with the contents of this slice.