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
listList<TSource>The list to use.
predicateFunc<TSource, bool>The predicate.
valueTSourceThe value to get if succeeded
Returns
- bool
Whether a value was found.
Type Parameters
TSourceValue type of list.