Method TryGetFirstValueWhere
- Namespace
- DisCatSharp.Common
- Assembly
- DisCatSharp.Common.dll
TryGetFirstValueWhere<TSource>(List<TSource?>?, Func<TSource?, bool>, out TSource?)
Safely tries to get the first match out of a list.
public static bool TryGetFirstValueWhere<TSource>(this List<TSource?>? list, Func<TSource?, bool> predicate, out TSource? value)
Parameters
list
List<TSource>The list to use.
predicate
Func<TSource, bool>The predicate.
value
TSourceThe value to get if succeeded
Returns
- bool
Whether a value was found.
Type Parameters
TSource
Value type of list.