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
mapperFunc<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
mapperif the current Optional<T> contains a value; otherwise, an empty Optional<T> of the target type.
Type Parameters
TOutThe type of the target value returned by
mapper