Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

ParallelEnumerable.SelectMany Method

Definition

Namespace:
System.Linq
Assemblies:
System.Core.dll, System.Linq.Parallel.dll
Assemblies:
netstandard.dll, System.Linq.Parallel.dll
Assembly:
System.Linq.Parallel.dll
Assembly:
System.Core.dll
Assembly:
netstandard.dll

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Projects in parallel each element of a sequence to an IEnumerable<T> and flattens the resulting sequences into one sequence.

Overloads

Name Description
SelectMany<TSource,TCollection,TResult>(ParallelQuery<TSource>, Func<TSource,IEnumerable<TCollection>>, Func<TSource,TCollection,TResult>)

Projects each element of a sequence to an IEnumerable<T>, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein.

SelectMany<TSource,TCollection,TResult>(ParallelQuery<TSource>, Func<TSource,Int32,IEnumerable<TCollection>>, Func<TSource,TCollection,TResult>)

Projects each element of a sequence to an IEnumerable<T>, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. The index of each source element is used in the intermediate projected form of that element.

SelectMany<TSource,TResult>(ParallelQuery<TSource>, Func<TSource,IEnumerable<TResult>>)

Projects in parallel each element of a sequence to an IEnumerable<T> and flattens the resulting sequences into one sequence.

SelectMany<TSource,TResult>(ParallelQuery<TSource>, Func<TSource,Int32,IEnumerable<TResult>>)

Projects in parallel each element of a sequence to an IEnumerable<T>, and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element.

SelectMany<TSource,TCollection,TResult>(ParallelQuery<TSource>, Func<TSource,IEnumerable<TCollection>>, Func<TSource,TCollection,TResult>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Projects each element of a sequence to an IEnumerable<T>, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein.

public:
generic <typename TSource, typename TCollection, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::ParallelQuery<TResult> ^ SelectMany(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, System::Collections::Generic::IEnumerable<TCollection> ^> ^ collectionSelector, Func<TSource, TCollection, TResult> ^ resultSelector);
public static System.Linq.ParallelQuery<TResult> SelectMany<TSource,TCollection,TResult>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,System.Collections.Generic.IEnumerable<TCollection>> collectionSelector, Func<TSource,TCollection,TResult> resultSelector);
static member SelectMany : System.Linq.ParallelQuery<'Source> * Func<'Source, seq<'Collection>> * Func<'Source, 'Collection, 'Result> -> System.Linq.ParallelQuery<'Result>
<Extension()>
Public Function SelectMany(Of TSource, TCollection, TResult) (source As ParallelQuery(Of TSource), collectionSelector As Func(Of TSource, IEnumerable(Of TCollection)), resultSelector As Func(Of TSource, TCollection, TResult)) As ParallelQuery(Of TResult)

Type Parameters

TSource

The type of the intermediate elements collected by collectionSelector.

TCollection

The type of elements of source.

TResult

The type of elements in the result sequence.

Parameters

source
ParallelQuery<TSource>

A sequence of values to project.

collectionSelector
Func<TSource,IEnumerable<TCollection>>

A transform function to apply to each source element; the second parameter of the function represents the index of the source element.

resultSelector
Func<TSource,TCollection,TResult>

A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence.

Returns

ParallelQuery<TResult>

A sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of source based on the index supplied to collectionSelector, and then mapping each of those sequence elements and their corresponding source element to a result element.

Exceptions

source or collectionSelector is a null reference (Nothing in Visual Basic).

More than Int32.MaxValue elements are enumerated by the query.

One or more exceptions occurred during the evaluation of the query.

See also

Applies to

SelectMany<TSource,TCollection,TResult>(ParallelQuery<TSource>, Func<TSource,Int32,IEnumerable<TCollection>>, Func<TSource,TCollection,TResult>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Projects each element of a sequence to an IEnumerable<T>, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. The index of each source element is used in the intermediate projected form of that element.

public:
generic <typename TSource, typename TCollection, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::ParallelQuery<TResult> ^ SelectMany(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, int, System::Collections::Generic::IEnumerable<TCollection> ^> ^ collectionSelector, Func<TSource, TCollection, TResult> ^ resultSelector);
public static System.Linq.ParallelQuery<TResult> SelectMany<TSource,TCollection,TResult>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,int,System.Collections.Generic.IEnumerable<TCollection>> collectionSelector, Func<TSource,TCollection,TResult> resultSelector);
static member SelectMany : System.Linq.ParallelQuery<'Source> * Func<'Source, int, seq<'Collection>> * Func<'Source, 'Collection, 'Result> -> System.Linq.ParallelQuery<'Result>
<Extension()>
Public Function SelectMany(Of TSource, TCollection, TResult) (source As ParallelQuery(Of TSource), collectionSelector As Func(Of TSource, Integer, IEnumerable(Of TCollection)), resultSelector As Func(Of TSource, TCollection, TResult)) As ParallelQuery(Of TResult)

Type Parameters

TSource

The type of the intermediate elements collected by collectionSelector.

TCollection

The type of elements of source.

TResult

The type of elements to return.

Parameters

source
ParallelQuery<TSource>

A sequence of values to project.

collectionSelector
Func<TSource,Int32,IEnumerable<TCollection>>

A transform function to apply to each source element; the second parameter of the function represents the index of the source element.

resultSelector
Func<TSource,TCollection,TResult>

A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence.

Returns

ParallelQuery<TResult>

A sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of source based on the index supplied to collectionSelector, and then mapping each of those sequence elements and their corresponding source element to a result element.

Exceptions

source or collectionSelector is a null reference (Nothing in Visual Basic).

More than Int32.MaxValue elements are enumerated by the query.

One or more exceptions occurred during the evaluation of the query.

See also

Applies to

SelectMany<TSource,TResult>(ParallelQuery<TSource>, Func<TSource,IEnumerable<TResult>>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Projects in parallel each element of a sequence to an IEnumerable<T> and flattens the resulting sequences into one sequence.

public:
generic <typename TSource, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::ParallelQuery<TResult> ^ SelectMany(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, System::Collections::Generic::IEnumerable<TResult> ^> ^ selector);
public static System.Linq.ParallelQuery<TResult> SelectMany<TSource,TResult>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,System.Collections.Generic.IEnumerable<TResult>> selector);
static member SelectMany : System.Linq.ParallelQuery<'Source> * Func<'Source, seq<'Result>> -> System.Linq.ParallelQuery<'Result>
<Extension()>
Public Function SelectMany(Of TSource, TResult) (source As ParallelQuery(Of TSource), selector As Func(Of TSource, IEnumerable(Of TResult))) As ParallelQuery(Of TResult)

Type Parameters

TSource

The type of elements of source.

TResult

The type of the elements of the sequence returned by selector.

Parameters

source
ParallelQuery<TSource>

A sequence of values to project.

selector
Func<TSource,IEnumerable<TResult>>

A transform function to apply to each element.

Returns

ParallelQuery<TResult>

A sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.

Exceptions

source or selector is a null reference (Nothing in Visual Basic).

One or more exceptions occurred during the evaluation of the query.

See also

Applies to

SelectMany<TSource,TResult>(ParallelQuery<TSource>, Func<TSource,Int32,IEnumerable<TResult>>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Projects in parallel each element of a sequence to an IEnumerable<T>, and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element.

public:
generic <typename TSource, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::ParallelQuery<TResult> ^ SelectMany(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, int, System::Collections::Generic::IEnumerable<TResult> ^> ^ selector);
public static System.Linq.ParallelQuery<TResult> SelectMany<TSource,TResult>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,int,System.Collections.Generic.IEnumerable<TResult>> selector);
static member SelectMany : System.Linq.ParallelQuery<'Source> * Func<'Source, int, seq<'Result>> -> System.Linq.ParallelQuery<'Result>
<Extension()>
Public Function SelectMany(Of TSource, TResult) (source As ParallelQuery(Of TSource), selector As Func(Of TSource, Integer, IEnumerable(Of TResult))) As ParallelQuery(Of TResult)

Type Parameters

TSource

The type of elements of source.

TResult

The type of the elements of the sequence returned by selector.

Parameters

source
ParallelQuery<TSource>

A sequence of values to project.

selector
Func<TSource,Int32,IEnumerable<TResult>>

A transform function to apply to each element.

Returns

ParallelQuery<TResult>

A sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.

Exceptions

source or selector is a null reference (Nothing in Visual Basic).

More than Int32.MaxValue elements are enumerated by the query.

One or more exceptions occurred during the evaluation of the query.

See also

Applies to


Feedback

Was this page helpful?