[This is preliminary documentation and is subject to change.]
Tries to find the first element that matches the predicate and returns it,
otherwise returns the first element found or default (i.e. null)
Namespace: NFXAssembly: NFX (in NFX.dll) Version: 3.0.0.1 (3.0.0.1)
public static TResult FirstOrAnyOrDefault<TResult>(
this IEnumerable<TResult> source,
Func<TResult, bool> predicate
)
public static TResult FirstOrAnyOrDefault<TResult>(
this IEnumerable<TResult> source,
Func<TResult, bool> predicate
)
<ExtensionAttribute>
Public Shared Function FirstOrAnyOrDefault(Of TResult) (
source As IEnumerable(Of TResult),
predicate As Func(Of TResult, Boolean)
) As TResult
<ExtensionAttribute>
Public Shared Function FirstOrAnyOrDefault(Of TResult) (
source As IEnumerable(Of TResult),
predicate As Func(Of TResult, Boolean)
) As TResult
public:
[ExtensionAttribute]
generic<typename TResult>
static TResult FirstOrAnyOrDefault(
IEnumerable<TResult>^ source,
Func<TResult, bool>^ predicate
)
public:
[ExtensionAttribute]
generic<typename TResult>
static TResult FirstOrAnyOrDefault(
IEnumerable<TResult>^ source,
Func<TResult, bool>^ predicate
)
static member FirstOrAnyOrDefault :
source : IEnumerable<'TResult> *
predicate : Func<'TResult, bool> -> 'TResult
static member FirstOrAnyOrDefault :
source : IEnumerable<'TResult> *
predicate : Func<'TResult, bool> -> 'TResult
- TResult
Return Value
Type:
TResultUsage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerable TResult . When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).