ImmutableArrayExtensions.SelectMany<TSource,TCollection,TResult>(ImmutableArray<TSource>, Func<TSource,IEnumerable<TCollection>>, Func<TSource,TCollection,TResult>) 方法

定义

将序列的每个元素投影到 IEnumerable<T>,并将结果序列合并为一个序列,并对其中每个元素调用结果选择器函数。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::Collections::Generic::IEnumerable<TResult> ^ SelectMany(System::Collections::Immutable::ImmutableArray<TSource> immutableArray, Func<TSource, System::Collections::Generic::IEnumerable<TCollection> ^> ^ collectionSelector, Func<TSource, TCollection, TResult> ^ resultSelector);
public static System.Collections.Generic.IEnumerable<TResult> SelectMany<TSource,TCollection,TResult> (this System.Collections.Immutable.ImmutableArray<TSource> immutableArray, Func<TSource,System.Collections.Generic.IEnumerable<TCollection>> collectionSelector, Func<TSource,TCollection,TResult> resultSelector);
public static System.Collections.Generic.IEnumerable<TResult> SelectMany<TSource,TCollection,TResult> (this System.Collections.Immutable.ImmutableArray<TSource>? immutableArray, Func<TSource,System.Collections.Generic.IEnumerable<TCollection>> collectionSelector, Func<TSource,TCollection,TResult> resultSelector);
static member SelectMany : System.Collections.Immutable.ImmutableArray<'Source> * Func<'Source, seq<'Collection>> * Func<'Source, 'Collection, 'Result> -> seq<'Result>
<Extension()>
Public Function SelectMany(Of TSource, TCollection, TResult) (immutableArray As ImmutableArray(Of TSource), collectionSelector As Func(Of TSource, IEnumerable(Of TCollection)), resultSelector As Func(Of TSource, TCollection, TResult)) As IEnumerable(Of TResult)

类型参数

TSource

immutableArray 的元素类型。The type of the elements of immutableArray.

TCollection

collectionSelector 收集的中间元素的类型。The type of the intermediate elements collected by collectionSelector.

TResult

结果序列的元素的类型。The type of the elements of the resulting sequence.

参数

immutableArray
ImmutableArray<TSource>

不可变数组。The immutable array.

collectionSelector
Func<TSource,IEnumerable<TCollection>>

应用于输入序列的每个元素的转换函数。A transform function to apply to each element of the input sequence.

resultSelector
Func<TSource,TCollection,TResult>

应用于中间序列的每个元素的转换函数。A transform function to apply to each element of the intermediate sequence.

返回

IEnumerable<TResult>

一个 IEnumerable<T>,其元素是通过以下方法得到的:对 immutableArray 的每个元素调用一对多转换函数 collectionSelector,然后将这些序列元素中的每一个元素及其相应的源元素映射到一个结果元素。An IEnumerable<T> whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of immutableArray and then mapping each of those sequence elements and their corresponding source element to a result element.

适用于