ParallelEnumerable.SelectMany Method

Definition

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

Overloads

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

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.

C#
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);

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

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

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

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.

C#
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);

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

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

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

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.

C#
public static System.Linq.ParallelQuery<TResult> SelectMany<TSource,TResult>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,System.Collections.Generic.IEnumerable<TResult>> selector);

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

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

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

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.

C#
public static System.Linq.ParallelQuery<TResult> SelectMany<TSource,TResult>(this System.Linq.ParallelQuery<TSource> source, Func<TSource,int,System.Collections.Generic.IEnumerable<TResult>> selector);

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

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0