Struct Optional

| MongoDB CSharp Driver API Reference (original) (raw)

Namespace

MongoDB.Driver

Assembly

MongoDB.Driver.dll

Represents an optional parameter that might or might not have a value.

public struct Optional<T>

Type Parameters

T

The type of the parameter.

Inherited Members

Constructors

Optional(T)

Initializes a new instance of the Optional struct with a value.

Properties

HasValue

Gets a value indicating whether the optional parameter has a value.

Value

Gets the value of the optional parameter.

Methods

Replaces(T)

Returns a value indicating whether this optional parameter contains a value that is not equal to an existing value.

WithDefault(T)

Returns either the value of this optional parameter if it has a value, otherwise a default value.

Operators

implicit operator Optional(T)

Performs an implicit conversion from to an Optional with a value.