MoreEnumerableScanRightTSource Method (IEnumerableTSource, FuncTSource, TSource, TSource) |
Namespace:
MoreLinq
Assembly:
MoreLinq (in MoreLinq.dll) Version: 2.10.0
Syntax public static IEnumerable<TSource> ScanRight<TSource>(
this IEnumerable<TSource> source,
Func<TSource, TSource, TSource> func
)
<ExtensionAttribute>
Public Shared Function ScanRight(Of TSource) (
source As IEnumerable(Of TSource),
func As Func(Of TSource, TSource, TSource)
) As IEnumerable(Of TSource)
public:
[ExtensionAttribute]
generic<typename TSource>
static IEnumerable<TSource>^ ScanRight(
IEnumerable<TSource>^ source,
Func<TSource, TSource, TSource>^ func
)
[<ExtensionAttribute>]
static member ScanRight :
source : IEnumerable<'TSource> *
func : Func<'TSource, 'TSource, 'TSource> -> IEnumerable<'TSource>
Parameters
- source
- Type: System.Collections.GenericIEnumerableTSource
Source sequence. - func
- Type: SystemFuncTSource, TSource, TSource
A right-associative accumulator function to be invoked on each element.
Its first argument is the current value in the sequence; second argument is the previous accumulator value.
Type Parameters
- TSource
- Type of elements in source sequence.
Return Value
Type:
IEnumerableTSourceThe scanned sequence.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableTSource. 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).
Remarks
This operator uses deferred execution and streams its results.
Source sequence is consumed greedily when an iteration of the resulting sequence begins.
Examples var result = Enumerable.Range(1, 5).Select(i => i.ToString()).ScanRight((a, b) => string.Format("({0}/{1})", a, b));
The
result variable will contain
[ "(1+(2+(3+(4+5))))", "(2+(3+(4+5)))", "(3+(4+5))", "(4+5)", "5" ].
See Also