Method Take
View SourceTake<TSource>(IEnumerable<TSource>, Range)
Returns a specified range of contiguous elements from a sequence.
Declaration
public static IEnumerable<TSource> Take<TSource>(IEnumerable<TSource> source, Range range)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TSource> | source | The sequence to return elements from. |
Range | range | The range of elements to return, which has start and end indexes either from the start or the end. |
Returns
Type | Description |
---|---|
IEnumerable<TSource> | An IEnumerable<T> that contains the specified |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of |
Remarks
Take<TSource>(IEnumerable<TSource>, Range) enumerates source
and yields elements whose indices belong to the
specified range
.
This method is implemented by using deferred execution.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|