Delegate TryGet<T, TResult>
- Namespace
- SodaFlow.Functional
- Assembly
- SodaFlow.Functional.dll
A method that gives a value from one input if it can. It reports the result through its return value, and gives the value through an output parameter.
public delegate bool TryGet<in T, TResult>(T value, out TResult result)
Parameters
valueTThe input to give a value from.
resultTResultSet to the value produced when this returns true, and left at the default for its type otherwise.
Returns
Type Parameters
TThe type of the input.
TResultThe type of the value produced.
- Extension Methods
Remarks
TryParse(string, out int) and TryGetValue(TKey, out TValue) have this shape. Give one to FromTryGet<T, TResult>(T, TryGet<T, TResult>) to get a Maybe<T> as a replacement for a flag and an output parameter.