Class Option
Helper static class with constructor methods for Option<T>.
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Collections
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
public static class Option
Properties
None
Creates a new empty Option<T> object.
Declaration
public static Option.NoneType None { get; }
Property Value
Type | Description |
---|---|
Option.NoneType |
Remarks
Since at the call site generic type argument T of the Option<T> is not known a special sentinel value of Option.NoneType is returned. It is implicitly casted into any Option<T> on demand.
Methods
FromNullable<T>(Nullable<T>)
Helper function to create Option<T> from Nullable<T>.
Declaration
public static Option<T> FromNullable<T>(T? nullable)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
Nullable<T> | nullable |
Returns
Type | Description |
---|---|
Option<T> |
Type Parameters
Name | Description |
---|---|
T |
Some<T>(T)
Creates a new Option<T> object initialized to a specified value.
Declaration
public static Option<T> Some<T>(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value |
Returns
Type | Description |
---|---|
Option<T> |
Type Parameters
Name | Description |
---|---|
T |
Remarks
Throws ArgumentNullException if value
is null.
Some<T>(T) constructor should be used only in places where value
is expected to be non-null.