Partilhar via


Optional<T> Struct

Definition

Combines a value, Value, and a flag, HasValue, indicating whether or not that value is meaningful.

generic <typename T>
public value class Optional
public readonly struct Optional<T>
type Optional<'T> = struct
Public Structure Optional(Of T)

Type Parameters

T

The type of the value.

Inheritance
Optional<T>

Constructors

Optional<T>(T)

Constructs an Optional<T> with a meaningful value.

Properties

HasValue

Returns true if the Value will return a meaningful value.

Value

Gets the value of the current object. Not meaningful unless HasValue returns true.

Methods

ToString()

Returns a string representation of this object.

Operators

Implicit(T to Optional<T>)

Applies to