-
Notifications
You must be signed in to change notification settings - Fork 15
GeneralTypesExtensions
public static T? AsNullable<T>(this Option<T> option) where T : structConverts an Option<T> to T?.
If option contains a value, then that value is returned. Otherwise null is returned. Note, this method is for structs only.
public static T? AsNullableRef<T>(this Option<T> option) where T : classConverts an Option<T> to T?.
If option contains a value, then that value is returned. Otherwise null is returned. Note, this method is for classes only and only really makes sense when used with C# 8's nullable reference types feature.
public static Option<T> ToOption<T>(this T obj)Performs a null-checked conversion of obj to an Option<T>.
If obj is null, then an Option<T> containing none is returned. Otherwise, an Option<T> containing obj is returned. This method supports both nullable structs and classes (nullable reference types in C# 8).
public static Option<T> TryCast<T>(this object value) where T : classAttempts to cast value to T and converts the result to an Option<T>, using ToOption (above).
If value is of type T, and is not null, then an Option<T> containing value is returned. Otherwise an Option<T> containing none is returned.
Action/FuncconversionsCyclemethods- Converting between
ActionandFunc - Extension methods for existing types that use
Option<T> - Indexed enumerations
IEnumerable<T>cons- Option-based parsers
- Partial function applications
- Pattern matching
- Pipe Operators
- Typed lambdas
AnyEither<TLeft,TRight>NoneOption<T>Success<T>Union<T1,T2>Union<T1,T2,T3>Union<T1,T2,T3,T4>UnitValueOrError