IOption<T> Interface

Summary

The interface for an option type. It Might hold a value, if so it is Some of Type T. Else it is implemented by None of type T.
graph TD Type["IOption<T>"] class Type type-node

Syntax

public interface IOption<T>

Type Parameters

Name Description
T

Methods

Name Value Summary
IfNotNullDo(Action<T>) void
Performs the Action withValue if a value is available.
Match(Action<T>, Action) void
Depending on weither the option actually holds a value the withValue is executed or the withoutValue is executed.
Match<TResult>(Func<T, TResult>, Func<TResult>) TResult
depending on weither the option holds a value or not the given function is executed to produce a returnvalue.
Match<TResult>(Func<T, TResult>, TResult) TResult
depending on weither the option holds a value or not the given values are returned.
ToNullable() T
Converts the IOption to T.

Extension Methods

Name Value Summary
Match<IOption<T>>() PatternMatchSingleContext<T>
Starts a pattern match for a single value. Subsequent calls to With() need to be used to specify conditions
ToOption<IOption<T>>() IOption<T>
Turns the type T into an option type.