Click or drag to resize

OptionalT Structure

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

Namespace:  MongoDB.Driver
Assembly:  MongoDB.Driver.Core (in MongoDB.Driver.Core.dll) Version: 2.10.0+569905ff5e778c38ea19d9d0392496a83e1704ed
Syntax
public struct Optional<T>

Type Parameters

T
The type of the parameter.

The OptionalT type exposes the following members.

Constructors
  NameDescription
Public methodOptionalT
Initializes a new instance of the OptionalT struct with a value.
Top
Properties
  NameDescription
Public propertyHasValue
Gets a value indicating whether the optional parameter has a value.
Public propertyValue
Gets the value of the optional parameter.
Top
Methods
  NameDescription
Public methodEquals
Indicates whether this instance and a specified object are equal.
(Inherited from ValueType.)
Public methodGetHashCode
Returns the hash code for this instance.
(Inherited from ValueType.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodReplaces
Returns a value indicating whether this optional parameter contains a value that is not equal to an existing value.
Public methodToString
Returns the fully qualified type name of this instance.
(Inherited from ValueType.)
Public methodWithDefault
Returns either the value of this optional parameter if it has a value, otherwise a default value.
Top
Operators
  NameDescription
Public operatorStatic member(T to OptionalT)
Performs an implicit conversion from to an OptionalT with a value.
Top
Extension Methods
  NameDescription
Public Extension MethodToBson
Serializes an object to a BSON byte array.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBsonDocument
Serializes an object to a BsonDocument.
(Defined by BsonExtensionMethods.)
Public Extension MethodToJson
Serializes an object to a JSON string.
(Defined by BsonExtensionMethods.)
Top
See Also