public static IEnumerable<T> Slice<T>(
this IEnumerable<T> sequence,
int startIndex,
int count
)
<ExtensionAttribute>
Public Shared Function Slice(Of T) (
sequence As IEnumerable(Of T),
startIndex As Integer,
count As Integer
) As IEnumerable(Of T)
public:
[ExtensionAttribute]
generic<typename T>
static IEnumerable<T>^ Slice(
IEnumerable<T>^ sequence,
int startIndex,
int count
)
[<ExtensionAttribute>]
static member Slice :
sequence : IEnumerable<'T> *
startIndex : int *
count : int -> IEnumerable<'T>
If the starting position or count specified result in slice extending past the end of the sequence, it will return all elements up to that point. There is no guarantee that the resulting sequence will contain the number of elements requested - it may have anywhere from 0 to count.
This method is implemented in an optimized manner for any sequence implementing IListT.
The result of SliceT(IEnumerableT, Int32, Int32) is identical to: sequence.Skip(startIndex).Take(count)