Skip to content

M_CSharpx_EnumerableExtensions_Pairwise__2

Moh.Hassan edited this page Oct 10, 2019 · 1 revision

EnumerableExtensions.Pairwise(TSource, TResult) Method

Returns a sequence resulting from applying a function to each element in the source sequence and its predecessor, with the exception of the first element which is only returned as the predecessor of the second element.

Namespace: CSharpx
Assembly: CommandLine (in CommandLine.dll) Version: 0.0.0

Syntax

C#

public static IEnumerable<TResult> Pairwise<TSource, TResult>(
	this IEnumerable<TSource> source,
	Func<TSource, TSource, TResult> resultSelector
)

VB

<ExtensionAttribute>
Public Shared Function Pairwise(Of TSource, TResult) ( 
	source As IEnumerable(Of TSource),
	resultSelector As Func(Of TSource, TSource, TResult)
) As IEnumerable(Of TResult)

C++

public:
[ExtensionAttribute]
generic<typename TSource, typename TResult>
static IEnumerable<TResult>^ Pairwise(
	IEnumerable<TSource>^ source, 
	Func<TSource, TSource, TResult>^ resultSelector
)

F#

[<ExtensionAttribute>]
static member Pairwise : 
        source : IEnumerable<'TSource> * 
        resultSelector : Func<'TSource, 'TSource, 'TResult> -> IEnumerable<'TResult> 

Parameters

 

source
Type: System.Collections.Generic.IEnumerable(TSource)
resultSelector
Type: System.Func(TSource, TSource, TResult)

Type Parameters

 

TSource
TResult

Return Value

Type: IEnumerable(TResult)

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable(TSource). 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

Reference

EnumerableExtensions Class
CSharpx Namespace

Clone this wiki locally