Optional<'T> Type

Helper type for handling the special way the Plotly.NET core API uses generics. In short, the problem arises because many optional parameters of Plotly.NET's core API are generics with a type constraint for `IConvertible`. This means that these parameters can be both value and reference types (e.g. `double` and `System.DateTime` both implement IConvertible). If we now have a optional parameter of type `T? where T: IConvertible` the compiler will not allow this without further type constrainst to eithe reference or value type. This is a problem because we want to 1. allow both, and 2. have a reliable way of determining if the value was not set because the F# API expects to be passed `Option.None` in that case. There exist other workarounds like checking if the value is default or null, but that changes valid default values actually set to null as well.

Constructors

Constructor Description

Optional(Value, IsSome)

Full Usage: Optional(Value, IsSome)

Parameters:
    Value : 'T - The value to mark as optional
    IsSome : bool - Wether or not the wrapped value is valid. This is used downstream to determine wether to wrap this value into `Option.Some` (if true) or `Option.None` (if false)

Helper type for handling the special way the Plotly.NET core API uses generics. In short, the problem arises because many optional parameters of Plotly.NET's core API are generics with a type constraint for `IConvertible`. This means that these parameters can be both value and reference types (e.g. `double` and `System.DateTime` both implement IConvertible). If we now have a optional parameter of type `T? where T: IConvertible` the compiler will not allow this without further type constrainst to eithe reference or value type. This is a problem because we want to 1. allow both, and 2. have a reliable way of determining if the value was not set because the F# API expects to be passed `Option.None` in that case. There exist other workarounds like checking if the value is default or null, but that changes valid default values actually set to null as well.

Value : 'T

The value to mark as optional

IsSome : bool

Wether or not the wrapped value is valid. This is used downstream to determine wether to wrap this value into `Option.Some` (if true) or `Option.None` (if false)

Instance members

Instance member Description

this.Deconstruct

Full Usage: this.Deconstruct

Parameters:
    Value : byref<'T>
    IsSome : byref<bool>

Value : byref<'T>
IsSome : byref<bool>

this.Equals

Full Usage: this.Equals

Parameters:
    obj : obj

Returns: bool
Modifiers: abstract

obj : obj
Returns: bool

this.Equals

Full Usage: this.Equals

Parameters:
Returns: bool
Modifiers: abstract

other : Optional<'T>
Returns: bool

this.GetHashCode

Full Usage: this.GetHashCode

Returns: int
Modifiers: abstract

Returns: int

this.IsSome

Full Usage: this.IsSome

this.ToString

Full Usage: this.ToString

Returns: string
Modifiers: abstract

Returns: string

this.Value

Full Usage: this.Value

Static members

Static member Description

left <> right

Full Usage: left <> right

Parameters:
Returns: bool

left : Optional<'T>
right : Optional<'T>
Returns: bool

left = right

Full Usage: left = right

Parameters:
Returns: bool

left : Optional<'T>
right : Optional<'T>
Returns: bool

op_ImplicitValue

Full Usage: op_ImplicitValue

Parameters:
    Value : 'T

Returns: Optional<'T>

Value : 'T
Returns: Optional<'T>