MoreLinq
TakeLast<(Of <(<'TSource>)>)> Method (source, count)
NamespacesMoreLinqMoreEnumerableTakeLast<(Of <<'(TSource>)>>)(IEnumerable<(Of <<'(TSource>)>>), Int32)
Returns a specified number of contiguous elements from the end of a sequence.
Declaration Syntax
C#Visual BasicVisual C++
public static IEnumerable<TSource> TakeLast<TSource>(
	this IEnumerable<TSource> source,
	int count
)
<ExtensionAttribute> _
Public Shared Function TakeLast(Of TSource) ( _
	source As IEnumerable(Of TSource), _
	count As Integer _
) As IEnumerable(Of TSource)
public:
[ExtensionAttribute]
generic<typename TSource>
static IEnumerable<TSource>^ TakeLast(
	IEnumerable<TSource>^ source, 
	int count
)
Generic Template Parameters
TSource
The type of the elements of source.
Parameters
source (IEnumerable<(Of <(<'TSource>)>)>)
The sequence to return the last element of.
count (Int32)
The number of elements to return.
Return Value
An IEnumerable<(Of <(<'T>)>)> that contains the specified number of elements from the end of the input sequence.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<(Of <(<'TSource>)>)>. When you use instance method syntax to call this method, omit the first parameter.
Remarks
This operator uses deferred execution and streams its results.
Examples
 Copy imageCopy
int[] numbers = { 12, 34, 56, 78 };
IEnumerable<int> result = numbers.TakeLast(2);
The result variable, when iterated over, will yield 34, 56 and 78 in turn.

Assembly: MoreLinq (Module: MoreLinq.dll) Version: 1.0.16006.0 (1.0.16006.1845)