Method FirstN
FirstN<TSource, TResult>(IEnumerable<TSource>, Func<TSource, TResult>, int)
Returns the first n results.
public static IEnumerable<TResult> FirstN<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector, int n)
Parameters
source
IEnumerable<TSource>The source.
selector
Func<TSource, TResult>The selector.
n
intThe number of results to return.
Returns
- IEnumerable<TResult>
The first n results.
Type Parameters
TSource
The source type.
TResult
The result type.
FirstN<TSource, TKey, TResult>(IEnumerable<TSource>, Func<TSource, TResult>, TKey, Func<TKey, int>)
Returns the first n results.
public static IEnumerable<TResult> FirstN<TSource, TKey, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector, TKey key, Func<TKey, int> n)
Parameters
source
IEnumerable<TSource>The source.
selector
Func<TSource, TResult>The selector.
key
TKeyThe key (needed to infer the key type and to determine the key serializer).
n
Func<TKey, int>The number of results to return.
Returns
- IEnumerable<TResult>
The first n results.
Type Parameters
TSource
The source type.
TKey
The key type.
TResult
The result type.