| BsonValue Class | 
 Inheritance Hierarchy
Inheritance HierarchyNamespace: MongoDB.Bson
 Syntax
SyntaxThe BsonValue type exposes the following members.
 Constructors
Constructors Methods
Methods| Name | Description | |
|---|---|---|
|  | Clone | 
            Creates a shallow clone of the BsonValue (see also DeepClone).
             | 
|  | CompareTo | 
            Compares this BsonValue to another BsonValue.
             | 
|  | CompareTypeTo | 
            Compares the type of this BsonValue to the type of another BsonValue.
             | 
|   | Create | 
            Creates a new instance of the BsonValue class.
             | 
|  | DeepClone | 
            Creates a deep clone of the BsonValue (see also Clone).
             | 
|  | Equals(Object) | 
            Compares this BsonValue to another object.
            (Overrides ObjectEquals(Object).) | 
|  | Equals(BsonValue) | 
            Compares this BsonValue to another BsonValue.
             | 
|  | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.) | 
|  | GetHashCode | 
            Gets the hash code.
            (Overrides ObjectGetHashCode.) | 
|  | GetType | Gets the Type of the current instance.(Inherited from Object.) | 
|  | IConvertibleGetTypeCodeImplementation | 
            Implementation of the IConvertible GetTypeCode method.
             | 
|  | IConvertibleToBooleanImplementation | 
            Implementation of the IConvertible ToBoolean method.
             | 
|  | IConvertibleToByteImplementation | 
            Implementation of the IConvertible ToByte method.
             | 
|  | IConvertibleToCharImplementation | 
            Implementation of the IConvertible ToChar method.
             | 
|  | IConvertibleToDateTimeImplementation | 
            Implementation of the IConvertible ToDateTime method.
             | 
|  | IConvertibleToDecimalImplementation | 
            Implementation of the IConvertible ToDecimal method.
             | 
|  | IConvertibleToDoubleImplementation | 
            Implementation of the IConvertible ToDouble method.
             | 
|  | IConvertibleToInt16Implementation | 
            Implementation of the IConvertible ToInt16 method.
             | 
|  | IConvertibleToInt32Implementation | 
            Implementation of the IConvertible ToInt32 method.
             | 
|  | IConvertibleToInt64Implementation | 
            Implementation of the IConvertible ToInt64 method.
             | 
|  | IConvertibleToSByteImplementation | 
            Implementation of the IConvertible ToSByte method.
             | 
|  | IConvertibleToSingleImplementation | 
            Implementation of the IConvertible ToSingle method.
             | 
|  | IConvertibleToStringImplementation | 
            Implementation of the IConvertible ToString method.
             | 
|  | IConvertibleToUInt16Implementation | 
            Implementation of the IConvertible ToUInt16 method.
             | 
|  | IConvertibleToUInt32Implementation | 
            Implementation of the IConvertible ToUInt32 method.
             | 
|  | IConvertibleToUInt64Implementation | 
            Implementation of the IConvertible ToUInt64 method.
             | 
|  | MemberwiseClone | Creates a shallow copy of the current Object.(Inherited from Object.) | 
|  | OperatorEqualsImplementation | 
            Implementation of operator ==.
             | 
|  | ToBoolean | 
            Converts this BsonValue to a Boolean (using the JavaScript definition of truthiness).
             | 
|  | ToDecimal | 
            Converts this BsonValue to a Decimal.
             | 
|  | ToDecimal128 | 
            Converts this BsonValue to a Decimal128.
             | 
|  | ToDouble | 
            Converts this BsonValue to a Double.
             | 
|  | ToInt32 | 
            Converts this BsonValue to an Int32.
             | 
|  | ToInt64 | 
            Converts this BsonValue to an Int64.
             | 
|  | ToLocalTime | 
            Converts this BsonValue to a DateTime in local time.
             | 
|  | ToNullableLocalTime | 
            Converts this BsonValue to a DateTime? in local time.
             | 
|  | ToNullableUniversalTime | 
            Converts this BsonValue to a DateTime? in UTC.
             | 
|  | ToString | Returns a string that represents the current object.(Inherited from Object.) | 
|  | ToUniversalTime | 
            Converts this BsonValue to a DateTime in UTC.
             | 
 Operators
Operators| Name | Description | |
|---|---|---|
|   | Equality | 
            Compares two BsonValues.
             | 
|   | (BsonValue to Boolean) | 
            Casts a BsonValue to a bool.
             | 
|   | (BsonValue to NullableBoolean) | 
            Casts a BsonValue to a bool?.
             | 
|   | (BsonValue to Byte) | 
            Casts a BsonValue to a byte[].
             | 
|   | (BsonValue to DateTime) | 
            Casts a BsonValue to a DateTime.
             | 
|   | (BsonValue to NullableDateTime) | 
            Casts a BsonValue to a DateTime?.
             | 
|   | (BsonValue to Decimal) | 
            Casts a BsonValue to a decimal.
             | 
|   | (BsonValue to NullableDecimal) | 
            Casts a BsonValue to a decimal?.
             | 
|   | (BsonValue to Decimal128) | 
            Casts a BsonValue to a Decimal128.
             | 
|   | (BsonValue to NullableDecimal128) | 
            Casts a BsonValue to a nullable Decimal128?.
             | 
|   | (BsonValue to Double) | 
            Casts a BsonValue to a double.
             | 
|   | (BsonValue to NullableDouble) | 
            Casts a BsonValue to a double?.
             | 
|   | (BsonValue to Guid) | 
            Casts a BsonValue to a Guid.
             | 
|   | (BsonValue to NullableGuid) | 
            Casts a BsonValue to a Guid?.
             | 
|   | (BsonValue to Int32) | 
            Casts a BsonValue to an int.
             | 
|   | (BsonValue to NullableInt32) | 
            Casts a BsonValue to an int?.
             | 
|   | (BsonValue to Int64) | 
            Casts a BsonValue to a long.
             | 
|   | (BsonValue to NullableInt64) | 
            Casts a BsonValue to a long?.
             | 
|   | (BsonValue to ObjectId) | 
            Casts a BsonValue to an ObjectId.
             | 
|   | (BsonValue to NullableObjectId) | 
            Casts a BsonValue to an ObjectId?.
             | 
|   | (BsonValue to Regex) | 
            Casts a BsonValue to a Regex.
             | 
|   | (BsonValue to String) | 
            Casts a BsonValue to a string.
             | 
|   | GreaterThan | 
            Compares two BsonValues.
             | 
|   | GreaterThanOrEqual | 
            Compares two BsonValues.
             | 
|   | (Boolean to BsonValue) | 
            Converts a bool to a BsonValue.
             | 
|   | (Byte to BsonValue) | 
            Converts a byte[] to a BsonValue.
             | 
|   | (DateTime to BsonValue) | 
            Converts a DateTime to a BsonValue.
             | 
|   | (Decimal to BsonValue) | 
            Converts a decimal to a BsonValue.
             | 
|   | (Double to BsonValue) | 
            Converts a double to a BsonValue.
             | 
|   | (Enum to BsonValue) | 
            Converts an Enum to a BsonValue.
             | 
|   | (Guid to BsonValue) | 
            Converts a Guid to a BsonValue.
             | 
|   | (Int32 to BsonValue) | 
            Converts an int to a BsonValue.
             | 
|   | (Int64 to BsonValue) | 
            Converts a long to a BsonValue.
             | 
|   | (NullableBoolean to BsonValue) | 
            Converts a bool? to a BsonValue.
             | 
|   | (NullableDateTime to BsonValue) | 
            Converts a DateTime? to a BsonValue.
             | 
|   | (NullableDecimal to BsonValue) | 
            Converts a decimal? to a BsonValue.
             | 
|   | (NullableDouble to BsonValue) | 
            Converts a double? to a BsonValue.
             | 
|   | (NullableGuid to BsonValue) | 
            Converts a Guid? to a BsonValue.
             | 
|   | (NullableInt32 to BsonValue) | 
            Converts an int? to a BsonValue.
             | 
|   | (NullableInt64 to BsonValue) | 
            Converts a long? to a BsonValue.
             | 
|   | (String to BsonValue) | 
            Converts a string to a BsonValue.
             | 
|   | (Regex to BsonValue) | 
            Converts a Regex to a BsonValue.
             | 
|   | (Decimal128 to BsonValue) | 
            Converts a Decimal128 to a BsonValue.
             | 
|   | (NullableDecimal128 to BsonValue) | 
            Converts a nullable Decimal128 to a BsonValue.
             | 
|   | (ObjectId to BsonValue) | 
            Converts an ObjectId to a BsonValue.
             | 
|   | (NullableObjectId to BsonValue) | 
            Converts an ObjectId? to a BsonValue.
             | 
|   | Inequality | 
            Compares two BsonValues.
             | 
|   | LessThan | 
            Compares two BsonValues.
             | 
|   | LessThanOrEqual | 
            Compares two BsonValues.
             | 
 Extension Methods
Extension Methods| Name | Description | |
|---|---|---|
|  | ToBson | 
            Serializes an object to a BSON byte array.
            (Defined by BsonExtensionMethods.) | 
|  | ToBsonDocument | 
            Serializes an object to a BsonDocument.
            (Defined by BsonExtensionMethods.) | 
|  | ToJson | 
            Serializes an object to a JSON string.
            (Defined by BsonExtensionMethods.) | 
 Properties
Properties| Name | Description | |
|---|---|---|
|  | AsBoolean | 
            Casts the BsonValue to a Boolean (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsBsonArray | 
            Casts the BsonValue to a BsonArray (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsBsonBinaryData | 
            Casts the BsonValue to a BsonBinaryData (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsBsonDateTime | 
            Casts the BsonValue to a BsonDateTime (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsBsonDocument | 
            Casts the BsonValue to a BsonDocument (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsBsonJavaScript | 
            Casts the BsonValue to a BsonJavaScript (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsBsonJavaScriptWithScope | 
            Casts the BsonValue to a BsonJavaScriptWithScope (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsBsonMaxKey | 
            Casts the BsonValue to a BsonMaxKey (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsBsonMinKey | 
            Casts the BsonValue to a BsonMinKey (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsBsonNull | 
            Casts the BsonValue to a BsonNull (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsBsonRegularExpression | 
            Casts the BsonValue to a BsonRegularExpression (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsBsonSymbol | 
            Casts the BsonValue to a BsonSymbol (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsBsonTimestamp | 
            Casts the BsonValue to a BsonTimestamp (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsBsonUndefined | 
            Casts the BsonValue to a BsonUndefined (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsBsonValue | 
            Casts the BsonValue to a BsonValue (a way of upcasting subclasses of BsonValue to BsonValue at compile time).
             | 
|  | AsByteArray | 
            Casts the BsonValue to a Byte[] (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsDateTime | Obsolete. 
            Casts the BsonValue to a DateTime in UTC (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsDecimal | 
            Casts the BsonValue to a Decimal (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsDecimal128 | 
            Casts the BsonValue to a Decimal128 (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsDouble | 
            Casts the BsonValue to a Double (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsGuid | 
            Casts the BsonValue to a Guid (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsInt32 | 
            Casts the BsonValue to an Int32 (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsInt64 | 
            Casts the BsonValue to a Int64 (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsLocalTime | Obsolete. 
            Casts the BsonValue to a DateTime in the local timezone (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsNullableBoolean | 
            Casts the BsonValue to a Nullable{Boolean} (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsNullableDateTime | Obsolete. 
            Casts the BsonValue to a Nullable{DateTime} (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsNullableDecimal | 
            Casts the BsonValue to a Nullable{Decimal} (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsNullableDecimal128 | 
            Casts the BsonValue to a Nullable{Decimal128} (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsNullableDouble | 
            Casts the BsonValue to a Nullable{Double} (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsNullableGuid | 
            Casts the BsonValue to a Nullable{Guid} (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsNullableInt32 | 
            Casts the BsonValue to a Nullable{Int32} (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsNullableInt64 | 
            Casts the BsonValue to a Nullable{Int64} (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsNullableObjectId | 
            Casts the BsonValue to a Nullable{ObjectId} (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsObjectId | 
            Casts the BsonValue to an ObjectId (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsRegex | 
            Casts the BsonValue to a Regex (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsString | 
            Casts the BsonValue to a String (throws an InvalidCastException if the cast is not valid).
             | 
|  | AsUniversalTime | Obsolete. 
            Casts the BsonValue to a DateTime in UTC (throws an InvalidCastException if the cast is not valid).
             | 
|  | BsonType | 
            Gets the BsonType of this BsonValue.
             | 
|  | IsBoolean | 
            Tests whether this BsonValue is a Boolean.
             | 
|  | IsBsonArray | 
            Tests whether this BsonValue is a BsonArray.
             | 
|  | IsBsonBinaryData | 
            Tests whether this BsonValue is a BsonBinaryData.
             | 
|  | IsBsonDateTime | 
            Tests whether this BsonValue is a BsonDateTime.
             | 
|  | IsBsonDocument | 
            Tests whether this BsonValue is a BsonDocument.
             | 
|  | IsBsonJavaScript | 
            Tests whether this BsonValue is a BsonJavaScript.
             | 
|  | IsBsonJavaScriptWithScope | 
            Tests whether this BsonValue is a BsonJavaScriptWithScope.
             | 
|  | IsBsonMaxKey | 
            Tests whether this BsonValue is a BsonMaxKey.
             | 
|  | IsBsonMinKey | 
            Tests whether this BsonValue is a BsonMinKey.
             | 
|  | IsBsonNull | 
            Tests whether this BsonValue is a BsonNull.
             | 
|  | IsBsonRegularExpression | 
            Tests whether this BsonValue is a BsonRegularExpression.
             | 
|  | IsBsonSymbol | 
            Tests whether this BsonValue is a BsonSymbol .
             | 
|  | IsBsonTimestamp | 
            Tests whether this BsonValue is a BsonTimestamp.
             | 
|  | IsBsonUndefined | 
            Tests whether this BsonValue is a BsonUndefined.
             | 
|  | IsDateTime | Obsolete. 
            Tests whether this BsonValue is a DateTime.
             | 
|  | IsDecimal128 | 
            Tests whether this BsonValue is a Decimal128.
             | 
|  | IsDouble | 
            Tests whether this BsonValue is a Double.
             | 
|  | IsGuid | 
            Tests whether this BsonValue is a Guid.
             | 
|  | IsInt32 | 
            Tests whether this BsonValue is an Int32.
             | 
|  | IsInt64 | 
            Tests whether this BsonValue is an Int64.
             | 
|  | IsNumeric | 
            Tests whether this BsonValue is a numeric value.
             | 
|  | IsObjectId | 
            Tests whether this BsonValue is an ObjectId .
             | 
|  | IsString | 
            Tests whether this BsonValue is a String.
             | 
|  | IsValidDateTime | 
            Tests whether this BsonValue is a valid DateTime.
             | 
|  | ItemInt32 | 
            Gets or sets a value by position (only applies to BsonDocument and BsonArray).
             | 
|  | ItemString | 
            Gets or sets a value by name (only applies to BsonDocument).
             | 
|  | RawValue | Obsolete. 
            Gets the raw value of this BsonValue (or null if this BsonValue doesn't have a single scalar value).
             | 
 See Also
See Also Inheritance Hierarchy
Inheritance Hierarchy