| CollectionExtensionsTakeT Method |
Retrieves the specified number of items from the source. If source contains less items than specified, all available items are returned.
Namespace: TomsToolbox.EssentialsAssembly: TomsToolbox.Essentials (in TomsToolbox.Essentials.dll) Version: 2.21.0+44d18b541fc9419ec3c549350a832394661b2a4d
XMLNS for XAML: Not mapped to an xmlns.
Syntax public static IList<T> Take<T>(
this IEnumerator<T> source,
int numberOfItems
)
<ExtensionAttribute>
Public Shared Function Take(Of T) (
source As IEnumerator(Of T),
numberOfItems As Integer
) As IList(Of T)
Parameters
- source IEnumeratorT
- The source enumerator to retrieve the items from. The enumerator position will be incremented by the number of items returned.
- numberOfItems Int32
- The number of items to retrieve.
Type Parameters
- T
- The type of elements in the list.
Return Value
IListTA list that contains up to n items from the source.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumeratorT. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also