ToNullable
Creates a nullable value from an Option one.
Parameters
Returns
Option<T> option
T?
Usage
It is created a nullable T? value from an Option<T>.
When the Option IsSome the nullable value will be receive the encapsulated value, otherwise, the nullable value will be null.
When the option value IsSome
Option<int> optionValue = 42;
int? result = optionValue.ToNullable();
//result = 42When the option value IsNone
Option<int> optionValue = Option<int>.None();
int? result = optionValue.ToNullable();
//result = nullLast updated
Was this helpful?