Optional(T) Structure (original) (raw)
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
Public Structure Optional(Of T)
[] type Optional<'T> = struct end
Type Parameters
T
The type of the parameter.
The OptionalT type exposes the following members.
Constructors
| | Name | Description | |
| ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------- |
| | OptionalT | Initializes a new instance of the OptionalT struct with a value. |
Properties
| | Name | Description | |
| ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------- |
| | HasValue | Gets a value indicating whether the optional parameter has a value. |
|
| Value | Gets the value of the optional parameter. |
Methods
| | Name | Description | |
| ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| | Equals | Indicates whether this instance and a specified object are equal. (Inherited from ValueType.) |
|
| GetHashCode | Returns the hash code for this instance. (Inherited from ValueType.) |
|
| GetType | Gets the Type of the current instance. (Inherited from Object.) |
|
| Replaces | Returns a value indicating whether this optional parameter contains a value that is not equal to an existing value. |
|
| ToString | Returns the fully qualified type name of this instance. (Inherited from ValueType.) |
|
| WithDefault | Returns either the value of this optional parameter if it has a value, otherwise a default value. |
Operators
| | Name | Description | |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| | (T to OptionalT) | Performs an implicit conversion from to an OptionalT with a value. |
Extension Methods
See Also