OptionExtensionsLinqFirstOrNoneT(IEnumerableT, FuncT, Boolean) Method
Returns Some of the first element of the
collection satisfying the
filter if any; None otherwise.
Assert(Array.Empty<int>().FirstOrNone(x => x > 2).IsNone);
Assert((new int[2] { 1, 2 }).FirstOrNone(x => x > 2).IsNone);
Assert((new int[2] { 1, 2 }).FirstOrNone(x => x > 1) == Some(2));
Namespace: Orx.Fun.OptionAssembly: Orx.Fun.Option (in Orx.Fun.Option.dll) Version: 1.2.1+ea79806fa5e0e04bfdaef2a1916930e75e2cde74
public static Opt<T> FirstOrNone<T>(
this IEnumerable<T> collection,
Func<T, bool> filter
)
- collection IEnumerableT
- Collection.
- filter FuncT, Boolean
- Predicate to filter the items of the collection.
- T
[Missing <typeparam name="T"/> documentation for "M:Orx.Fun.Option.OptionExtensionsLinq.FirstOrNone``1(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.Boolean})"]
OptTIn Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableT. 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).