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.6.0+Branch.origin/v2.6.x.Sha.593796a7b35dc59243383bcc684de296a5468f2e
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 (Inherited from ValueType.)
Public methodGetHashCode (Inherited from ValueType.)
Public methodGetType (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 (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