MoreEnumerableCountDownT, TResult Method
Provides a countdown counter for a given count of elements at the
tail of the sequence where zero always represents the last element,
one represents the second-last element, two represents the
third-last element and so on.
Namespace: MoreLinqAssembly: MoreLinq (in MoreLinq.dll) Version: 3.4.0+b99a6a8cc504caf2d48372fe54a2f8116c59cd0c
public static IEnumerable<TResult> CountDown<T, TResult>(
this IEnumerable<T> source,
int count,
Func<T, int?, TResult> resultSelector
)
<ExtensionAttribute>
Public Shared Function CountDown(Of T, TResult) (
source As IEnumerable(Of T),
count As Integer,
resultSelector As Func(Of T, Integer?, TResult)
) As IEnumerable(Of TResult)
public:
[ExtensionAttribute]
generic<typename T, typename TResult>
static IEnumerable<TResult>^ CountDown(
IEnumerable<T>^ source,
int count,
Func<T, Nullable<int>, TResult>^ resultSelector
)
[<ExtensionAttribute>]
static member CountDown :
source : IEnumerable<'T> *
count : int *
resultSelector : Func<'T, Nullable<int>, 'TResult> -> IEnumerable<'TResult>
- source IEnumerableT
- The source sequence.
- count Int32
- Count of tail elements of
source to count down.
- resultSelector FuncT, NullableInt32, TResult
-
A function that receives the element and the current countdown
value for the element and which returns those mapped to a
result returned in the resulting sequence. For elements before
the last count, the countdown value is
null.
- T
-
The type of elements of source
- TResult
-
The type of elements of the resulting sequence.
IEnumerableTResult
A sequence of results returned by
resultSelector.In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableT. 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).
This method uses deferred execution semantics and streams its
results. At most, count elements of the source
sequence may be buffered at any one time unless
source is a collection or a list.