Click or drag to resize

BsonValue Class

Represents a BSON value (this is an abstract class, see the various subclasses).
Inheritance Hierarchy
SystemObject
  MongoDB.BsonBsonValue
    More...

Namespace:  MongoDB.Bson
Assembly:  MongoDB.Bson (in MongoDB.Bson.dll) Version: 2.22.0+75246110ed1247226fcc7f8eb2c54ffab745693e
Syntax
[SerializableAttribute]
public abstract class BsonValue : IComparable<BsonValue>, 
	IConvertible, IEquatable<BsonValue>

The BsonValue type exposes the following members.

Constructors
  NameDescription
Protected methodBsonValue
Initializes a new instance of the BsonValue class
Top
Properties
  NameDescription
Public propertyAsBoolean
Casts the BsonValue to a Boolean (throws an InvalidCastException if the cast is not valid).
Public propertyAsBsonArray
Casts the BsonValue to a BsonArray (throws an InvalidCastException if the cast is not valid).
Public propertyAsBsonBinaryData
Casts the BsonValue to a BsonBinaryData (throws an InvalidCastException if the cast is not valid).
Public propertyAsBsonDateTime
Casts the BsonValue to a BsonDateTime (throws an InvalidCastException if the cast is not valid).
Public propertyAsBsonDocument
Casts the BsonValue to a BsonDocument (throws an InvalidCastException if the cast is not valid).
Public propertyAsBsonJavaScript
Casts the BsonValue to a BsonJavaScript (throws an InvalidCastException if the cast is not valid).
Public propertyAsBsonJavaScriptWithScope
Casts the BsonValue to a BsonJavaScriptWithScope (throws an InvalidCastException if the cast is not valid).
Public propertyAsBsonMaxKey
Casts the BsonValue to a BsonMaxKey (throws an InvalidCastException if the cast is not valid).
Public propertyAsBsonMinKey
Casts the BsonValue to a BsonMinKey (throws an InvalidCastException if the cast is not valid).
Public propertyAsBsonNull
Casts the BsonValue to a BsonNull (throws an InvalidCastException if the cast is not valid).
Public propertyAsBsonRegularExpression
Casts the BsonValue to a BsonRegularExpression (throws an InvalidCastException if the cast is not valid).
Public propertyAsBsonSymbol
Casts the BsonValue to a BsonSymbol (throws an InvalidCastException if the cast is not valid).
Public propertyAsBsonTimestamp
Casts the BsonValue to a BsonTimestamp (throws an InvalidCastException if the cast is not valid).
Public propertyAsBsonUndefined
Casts the BsonValue to a BsonUndefined (throws an InvalidCastException if the cast is not valid).
Public propertyAsBsonValue
Casts the BsonValue to a BsonValue (a way of upcasting subclasses of BsonValue to BsonValue at compile time).
Public propertyAsByteArray
Casts the BsonValue to a Byte[] (throws an InvalidCastException if the cast is not valid).
Public propertyAsDateTime Obsolete.
Casts the BsonValue to a DateTime in UTC (throws an InvalidCastException if the cast is not valid).
Public propertyAsDecimal
Casts the BsonValue to a Decimal (throws an InvalidCastException if the cast is not valid).
Public propertyAsDecimal128
Casts the BsonValue to a Decimal128 (throws an InvalidCastException if the cast is not valid).
Public propertyAsDouble
Casts the BsonValue to a Double (throws an InvalidCastException if the cast is not valid).
Public propertyAsGuid
Casts the BsonValue to a Guid (throws an InvalidCastException if the cast is not valid).
Public propertyAsInt32
Casts the BsonValue to an Int32 (throws an InvalidCastException if the cast is not valid).
Public propertyAsInt64
Casts the BsonValue to a Int64 (throws an InvalidCastException if the cast is not valid).
Public propertyAsLocalTime Obsolete.
Casts the BsonValue to a DateTime in the local timezone (throws an InvalidCastException if the cast is not valid).
Public propertyAsNullableBoolean
Casts the BsonValue to a Nullable{Boolean} (throws an InvalidCastException if the cast is not valid).
Public propertyAsNullableDateTime Obsolete.
Casts the BsonValue to a Nullable{DateTime} (throws an InvalidCastException if the cast is not valid).
Public propertyAsNullableDecimal
Casts the BsonValue to a Nullable{Decimal} (throws an InvalidCastException if the cast is not valid).
Public propertyAsNullableDecimal128
Casts the BsonValue to a Nullable{Decimal128} (throws an InvalidCastException if the cast is not valid).
Public propertyAsNullableDouble
Casts the BsonValue to a Nullable{Double} (throws an InvalidCastException if the cast is not valid).
Public propertyAsNullableGuid
Casts the BsonValue to a Nullable{Guid} (throws an InvalidCastException if the cast is not valid).
Public propertyAsNullableInt32
Casts the BsonValue to a Nullable{Int32} (throws an InvalidCastException if the cast is not valid).
Public propertyAsNullableInt64
Casts the BsonValue to a Nullable{Int64} (throws an InvalidCastException if the cast is not valid).
Public propertyAsNullableObjectId
Casts the BsonValue to a Nullable{ObjectId} (throws an InvalidCastException if the cast is not valid).
Public propertyAsObjectId
Casts the BsonValue to an ObjectId (throws an InvalidCastException if the cast is not valid).
Public propertyAsRegex
Casts the BsonValue to a Regex (throws an InvalidCastException if the cast is not valid).
Public propertyAsString
Casts the BsonValue to a String (throws an InvalidCastException if the cast is not valid).
Public propertyAsUniversalTime Obsolete.
Casts the BsonValue to a DateTime in UTC (throws an InvalidCastException if the cast is not valid).
Public propertyBsonType
Gets the BsonType of this BsonValue.
Public propertyIsBoolean
Tests whether this BsonValue is a Boolean.
Public propertyIsBsonArray
Tests whether this BsonValue is a BsonArray.
Public propertyIsBsonBinaryData
Tests whether this BsonValue is a BsonBinaryData.
Public propertyIsBsonDateTime
Tests whether this BsonValue is a BsonDateTime.
Public propertyIsBsonDocument
Tests whether this BsonValue is a BsonDocument.
Public propertyIsBsonJavaScript
Tests whether this BsonValue is a BsonJavaScript.
Public propertyIsBsonJavaScriptWithScope
Tests whether this BsonValue is a BsonJavaScriptWithScope.
Public propertyIsBsonMaxKey
Tests whether this BsonValue is a BsonMaxKey.
Public propertyIsBsonMinKey
Tests whether this BsonValue is a BsonMinKey.
Public propertyIsBsonNull
Tests whether this BsonValue is a BsonNull.
Public propertyIsBsonRegularExpression
Tests whether this BsonValue is a BsonRegularExpression.
Public propertyIsBsonSymbol
Tests whether this BsonValue is a BsonSymbol .
Public propertyIsBsonTimestamp
Tests whether this BsonValue is a BsonTimestamp.
Public propertyIsBsonUndefined
Tests whether this BsonValue is a BsonUndefined.
Public propertyIsDateTime Obsolete.
Tests whether this BsonValue is a DateTime.
Public propertyIsDecimal128
Tests whether this BsonValue is a Decimal128.
Public propertyIsDouble
Tests whether this BsonValue is a Double.
Public propertyIsGuid
Tests whether this BsonValue is a Guid.
Public propertyIsInt32
Tests whether this BsonValue is an Int32.
Public propertyIsInt64
Tests whether this BsonValue is an Int64.
Public propertyIsNumeric
Tests whether this BsonValue is a numeric value.
Public propertyIsObjectId
Tests whether this BsonValue is an ObjectId .
Public propertyIsString
Tests whether this BsonValue is a String.
Public propertyIsValidDateTime
Tests whether this BsonValue is a valid DateTime.
Public propertyItemInt32
Gets or sets a value by position (only applies to BsonDocument and BsonArray).
Public propertyItemString
Gets or sets a value by name (only applies to BsonDocument).
Public propertyRawValue Obsolete.
Gets the raw value of this BsonValue (or null if this BsonValue doesn't have a single scalar value).
Top
Methods
  NameDescription
Public methodClone
Creates a shallow clone of the BsonValue (see also DeepClone).
Public methodCompareTo
Compares this BsonValue to another BsonValue.
Public methodCompareTypeTo
Compares the type of this BsonValue to the type of another BsonValue.
Public methodStatic memberCreate
Creates a new instance of the BsonValue class.
Public methodDeepClone
Creates a deep clone of the BsonValue (see also Clone).
Public methodEquals(Object)
Compares this BsonValue to another object.
(Overrides ObjectEquals(Object).)
Public methodEquals(BsonValue)
Compares this BsonValue to another BsonValue.
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Gets the hash code.
(Overrides ObjectGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodIConvertibleGetTypeCodeImplementation
Implementation of the IConvertible GetTypeCode method.
Protected methodIConvertibleToBooleanImplementation
Implementation of the IConvertible ToBoolean method.
Protected methodIConvertibleToByteImplementation
Implementation of the IConvertible ToByte method.
Protected methodIConvertibleToCharImplementation
Implementation of the IConvertible ToChar method.
Protected methodIConvertibleToDateTimeImplementation
Implementation of the IConvertible ToDateTime method.
Protected methodIConvertibleToDecimalImplementation
Implementation of the IConvertible ToDecimal method.
Protected methodIConvertibleToDoubleImplementation
Implementation of the IConvertible ToDouble method.
Protected methodIConvertibleToInt16Implementation
Implementation of the IConvertible ToInt16 method.
Protected methodIConvertibleToInt32Implementation
Implementation of the IConvertible ToInt32 method.
Protected methodIConvertibleToInt64Implementation
Implementation of the IConvertible ToInt64 method.
Protected methodIConvertibleToSByteImplementation
Implementation of the IConvertible ToSByte method.
Protected methodIConvertibleToSingleImplementation
Implementation of the IConvertible ToSingle method.
Protected methodIConvertibleToStringImplementation
Implementation of the IConvertible ToString method.
Protected methodIConvertibleToUInt16Implementation
Implementation of the IConvertible ToUInt16 method.
Protected methodIConvertibleToUInt32Implementation
Implementation of the IConvertible ToUInt32 method.
Protected methodIConvertibleToUInt64Implementation
Implementation of the IConvertible ToUInt64 method.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOperatorEqualsImplementation
Implementation of operator ==.
Public methodToBoolean
Converts this BsonValue to a Boolean (using the JavaScript definition of truthiness).
Public methodToDecimal
Converts this BsonValue to a Decimal.
Public methodToDecimal128
Converts this BsonValue to a Decimal128.
Public methodToDouble
Converts this BsonValue to a Double.
Public methodToInt32
Converts this BsonValue to an Int32.
Public methodToInt64
Converts this BsonValue to an Int64.
Public methodToLocalTime
Converts this BsonValue to a DateTime in local time.
Public methodToNullableLocalTime
Converts this BsonValue to a DateTime? in local time.
Public methodToNullableUniversalTime
Converts this BsonValue to a DateTime? in UTC.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodToUniversalTime
Converts this BsonValue to a DateTime in UTC.
Top
Operators
  NameDescription
Public operatorStatic memberEquality
Compares two BsonValues.
Public operatorStatic member(BsonValue to Boolean)
Casts a BsonValue to a bool.
Public operatorStatic member(BsonValue to NullableBoolean)
Casts a BsonValue to a bool?.
Public operatorStatic member(BsonValue to Byte)
Casts a BsonValue to a byte[].
Public operatorStatic member(BsonValue to DateTime)
Casts a BsonValue to a DateTime.
Public operatorStatic member(BsonValue to NullableDateTime)
Casts a BsonValue to a DateTime?.
Public operatorStatic member(BsonValue to Decimal)
Casts a BsonValue to a decimal.
Public operatorStatic member(BsonValue to NullableDecimal)
Casts a BsonValue to a decimal?.
Public operatorStatic member(BsonValue to Decimal128)
Casts a BsonValue to a Decimal128.
Public operatorStatic member(BsonValue to NullableDecimal128)
Casts a BsonValue to a nullable Decimal128?.
Public operatorStatic member(BsonValue to Double)
Casts a BsonValue to a double.
Public operatorStatic member(BsonValue to NullableDouble)
Casts a BsonValue to a double?.
Public operatorStatic member(BsonValue to Guid)
Casts a BsonValue to a Guid.
Public operatorStatic member(BsonValue to NullableGuid)
Casts a BsonValue to a Guid?.
Public operatorStatic member(BsonValue to Int32)
Casts a BsonValue to an int.
Public operatorStatic member(BsonValue to NullableInt32)
Casts a BsonValue to an int?.
Public operatorStatic member(BsonValue to Int64)
Casts a BsonValue to a long.
Public operatorStatic member(BsonValue to NullableInt64)
Casts a BsonValue to a long?.
Public operatorStatic member(BsonValue to ObjectId)
Casts a BsonValue to an ObjectId.
Public operatorStatic member(BsonValue to NullableObjectId)
Casts a BsonValue to an ObjectId?.
Public operatorStatic member(BsonValue to Regex)
Casts a BsonValue to a Regex.
Public operatorStatic member(BsonValue to String)
Casts a BsonValue to a string.
Public operatorStatic memberGreaterThan
Compares two BsonValues.
Public operatorStatic memberGreaterThanOrEqual
Compares two BsonValues.
Public operatorStatic member(Boolean to BsonValue)
Converts a bool to a BsonValue.
Public operatorStatic member(Byte to BsonValue)
Converts a byte[] to a BsonValue.
Public operatorStatic member(DateTime to BsonValue)
Converts a DateTime to a BsonValue.
Public operatorStatic member(Decimal to BsonValue)
Converts a decimal to a BsonValue.
Public operatorStatic member(Double to BsonValue)
Converts a double to a BsonValue.
Public operatorStatic member(Enum to BsonValue)
Converts an Enum to a BsonValue.
Public operatorStatic member(Guid to BsonValue) Obsolete.
Converts a Guid to a BsonValue.
Public operatorStatic member(Int32 to BsonValue)
Converts an int to a BsonValue.
Public operatorStatic member(Int64 to BsonValue)
Converts a long to a BsonValue.
Public operatorStatic member(NullableBoolean to BsonValue)
Converts a bool? to a BsonValue.
Public operatorStatic member(NullableDateTime to BsonValue)
Converts a DateTime? to a BsonValue.
Public operatorStatic member(NullableDecimal to BsonValue)
Converts a decimal? to a BsonValue.
Public operatorStatic member(NullableDouble to BsonValue)
Converts a double? to a BsonValue.
Public operatorStatic member(NullableGuid to BsonValue) Obsolete.
Converts a Guid? to a BsonValue.
Public operatorStatic member(NullableInt32 to BsonValue)
Converts an int? to a BsonValue.
Public operatorStatic member(NullableInt64 to BsonValue)
Converts a long? to a BsonValue.
Public operatorStatic member(String to BsonValue)
Converts a string to a BsonValue.
Public operatorStatic member(Regex to BsonValue)
Converts a Regex to a BsonValue.
Public operatorStatic member(Decimal128 to BsonValue)
Converts a Decimal128 to a BsonValue.
Public operatorStatic member(NullableDecimal128 to BsonValue)
Converts a nullable Decimal128 to a BsonValue.
Public operatorStatic member(ObjectId to BsonValue)
Converts an ObjectId to a BsonValue.
Public operatorStatic member(NullableObjectId to BsonValue)
Converts an ObjectId? to a BsonValue.
Public operatorStatic memberInequality
Compares two BsonValues.
Public operatorStatic memberLessThan
Compares two BsonValues.
Public operatorStatic memberLessThanOrEqual
Compares two BsonValues.
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
Inheritance Hierarchy
SystemObject
  MongoDB.BsonBsonValue
    MongoDB.BsonBsonArray
    MongoDB.BsonBsonBinaryData
    MongoDB.BsonBsonBoolean
    MongoDB.BsonBsonDateTime
    MongoDB.BsonBsonDecimal128
    MongoDB.BsonBsonDocument
    MongoDB.BsonBsonDouble
    MongoDB.BsonBsonInt32
    MongoDB.BsonBsonInt64
    MongoDB.BsonBsonJavaScript
    MongoDB.BsonBsonMaxKey
    MongoDB.BsonBsonMinKey
    MongoDB.BsonBsonNull
    MongoDB.BsonBsonObjectId
    MongoDB.BsonBsonRegularExpression
    MongoDB.BsonBsonString
    MongoDB.BsonBsonSymbol
    MongoDB.BsonBsonTimestamp
    MongoDB.BsonBsonUndefined