IndexOf<>(source, predicate, startIndex) IndexOf<>(source, element, comparer) JoinString<>(values, separator, prefix, suffix, lastSeparator) Order<>(source, comparer) SkipLast<>(source, count, throwIfNotEnough) Split<>(splitWhat, splitWhere) Split<>(source, chunkSize) ToDictionary2<>(source, key1Selector, key2Selector, comparer1, comparer2) ToDictionary2<>(source, key1Selector, key2Selector, elementSelector, comparer1, comparer2)
Legend Class Struct Enum Interface Delegate | Constructor Method Property Event Field |
| Extension method: T? FirstOrNull<T>(this IEnumerable<T>, Func<T, bool>)Declarationpublic static T? FirstOrNull<T>(
this IEnumerable<T> source,
Func<T, bool> predicate
) Summary
Returns the first element of a sequence that satisfies a given predicate, or null if the sequence
contains no elements. Generic type parametersT |
The type of the elements of source. |
Parametersthis IEnumerable<T> | source |
The IEnumerable<T> to return the first element of. | Func<T, bool> | predicate |
Only consider elements that satisfy this predicate. |
Returnsnull if source is empty; otherwise, the first element in source. |