Method Map
- Namespace
- DisCatSharp.Entities
- Assembly
- DisCatSharp.dll
Map<TOut>(Func<T, TOut>)
Performs a mapping operation on the current Optional<T>, turning it into an Optional holding a
TOut
instance if the source optional contains a value; otherwise, returns an
Optional<T> of that same type with no value.
public Optional<TOut> Map<TOut>(Func<T, TOut> mapper)
Parameters
mapper
Func<T, TOut>The mapping function to apply on the current value if it exists
Returns
- Optional<TOut>
An Optional<T> containing a value denoted by calling
mapper
if the current Optional<T> contains a value; otherwise, an empty Optional<T> of the target type.
Type Parameters
TOut
The type of the target value returned by
mapper