NDepend.API Documentation
FirstOrAnyOrDefault<T> Method
NDepend.Helpers Namespace > ExtensionMethodsEnumerable Class : FirstOrAnyOrDefault<T> Method
The element type.
A sequence of elements.
A predicate on elements
Returns the first element of a sequence satisfying predicate, or the first element of the sequence, or a default value if no element is found.
Syntax
[Extension()]
public static T FirstOrAnyOrDefault<T>( 
   IEnumerable<T> seq,
   Func<T,bool> predicate
)

Parameters

seq
A sequence of elements.
predicate
A predicate on elements

Type Parameters

T
The element type.
Requirements

Target Platforms: Windows 11, 10, 8, 7 and Linux, MacOS with net8.0, net7.0 or net6.0 installed

See Also

Reference

ExtensionMethodsEnumerable Class
ExtensionMethodsEnumerable Members