Click or drag to resize

BsonValue Class

Represents a BSON value (this is an abstract class, see the various subclasses).
Inheritance Hierarchy
System.Object
  MongoDB.Bson.BsonValue
    More...

Namespace:  MongoDB.Bson
Assembly:  MongoDB.Bson (in MongoDB.Bson.dll) Version: 2.21.0+5a9c3311e158910b88195f290e6d4b1b2715d2b2
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 propertyItem[Int32]
Gets or sets a value by position (only applies to BsonDocument and BsonArray).
Public propertyItem[String]
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 Object.Equals(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 Object.GetHashCode().)
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 memberExplicit(BsonValue to Boolean)
Casts a BsonValue to a bool.
Public operatorStatic memberExplicit(BsonValue to Nullable<Boolean>)
Casts a BsonValue to a bool?.
Public operatorStatic memberExplicit(BsonValue toByte[])
Casts a BsonValue to a byte[].
Public operatorStatic memberExplicit(BsonValue to DateTime)
Casts a BsonValue to a DateTime.
Public operatorStatic memberExplicit(BsonValue to Nullable<DateTime>)
Casts a BsonValue to a DateTime?.
Public operatorStatic memberExplicit(BsonValue to Decimal)
Casts a BsonValue to a decimal.
Public operatorStatic memberExplicit(BsonValue to Nullable<Decimal>)
Casts a BsonValue to a decimal?.
Public operatorStatic memberExplicit(BsonValue to Decimal128)
Casts a BsonValue to a Decimal128.
Public operatorStatic memberExplicit(BsonValue to Nullable<Decimal128>)
Casts a BsonValue to a nullable Decimal128?.
Public operatorStatic memberExplicit(BsonValue to Double)
Casts a BsonValue to a double.
Public operatorStatic memberExplicit(BsonValue to Nullable<Double>)
Casts a BsonValue to a double?.
Public operatorStatic memberExplicit(BsonValue to Guid)
Casts a BsonValue to a Guid.
Public operatorStatic memberExplicit(BsonValue to Nullable<Guid>)
Casts a BsonValue to a Guid?.
Public operatorStatic memberExplicit(BsonValue to Int32)
Casts a BsonValue to an int.
Public operatorStatic memberExplicit(BsonValue to Nullable<Int32>)
Casts a BsonValue to an int?.
Public operatorStatic memberExplicit(BsonValue to Int64)
Casts a BsonValue to a long.
Public operatorStatic memberExplicit(BsonValue to Nullable<Int64>)
Casts a BsonValue to a long?.
Public operatorStatic memberExplicit(BsonValue to ObjectId)
Casts a BsonValue to an ObjectId.
Public operatorStatic memberExplicit(BsonValue to Nullable<ObjectId>)
Casts a BsonValue to an ObjectId?.
Public operatorStatic memberExplicit(BsonValue to Regex)
Casts a BsonValue to a Regex.
Public operatorStatic memberExplicit(BsonValue to String)
Casts a BsonValue to a string.
Public operatorStatic memberGreaterThan
Compares two BsonValues.
Public operatorStatic memberGreaterThanOrEqual
Compares two BsonValues.
Public operatorStatic memberImplicit(Boolean to BsonValue)
Converts a bool to a BsonValue.
Public operatorStatic memberImplicit(Byte[] to BsonValue)
Converts a byte[] to a BsonValue.
Public operatorStatic memberImplicit(DateTime to BsonValue)
Converts a DateTime to a BsonValue.
Public operatorStatic memberImplicit(Decimal to BsonValue)
Converts a decimal to a BsonValue.
Public operatorStatic memberImplicit(Double to BsonValue)
Converts a double to a BsonValue.
Public operatorStatic memberImplicit(Enum to BsonValue)
Converts an Enum to a BsonValue.
Public operatorStatic memberImplicit(Guid to BsonValue) Obsolete.
Converts a Guid to a BsonValue.
Public operatorStatic memberImplicit(Int32 to BsonValue)
Converts an int to a BsonValue.
Public operatorStatic memberImplicit(Int64 to BsonValue)
Converts a long to a BsonValue.
Public operatorStatic memberImplicit(Nullable<Boolean> to BsonValue)
Converts a bool? to a BsonValue.
Public operatorStatic memberImplicit(Nullable<DateTime> to BsonValue)
Converts a DateTime? to a BsonValue.
Public operatorStatic memberImplicit(Nullable<Decimal> to BsonValue)
Converts a decimal? to a BsonValue.
Public operatorStatic memberImplicit(Nullable<Double> to BsonValue)
Converts a double? to a BsonValue.
Public operatorStatic memberImplicit(Nullable<Guid> to BsonValue) Obsolete.
Converts a Guid? to a BsonValue.
Public operatorStatic memberImplicit(Nullable<Int32> to BsonValue)
Converts an int? to a BsonValue.
Public operatorStatic memberImplicit(Nullable<Int64> to BsonValue)
Converts a long? to a BsonValue.
Public operatorStatic memberImplicit(String to BsonValue)
Converts a string to a BsonValue.
Public operatorStatic memberImplicit(Regex to BsonValue)
Converts a Regex to a BsonValue.
Public operatorStatic memberImplicit(Decimal128 to BsonValue)
Converts a Decimal128 to a BsonValue.
Public operatorStatic memberImplicit(Nullable<Decimal128> to BsonValue)
Converts a nullable Decimal128 to a BsonValue.
Public operatorStatic memberImplicit(ObjectId to BsonValue)
Converts an ObjectId to a BsonValue.
Public operatorStatic memberImplicit(Nullable<ObjectId> 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
System.Object
  MongoDB.Bson.BsonValue
    MongoDB.Bson.BsonArray
    MongoDB.Bson.BsonBinaryData
    MongoDB.Bson.BsonBoolean
    MongoDB.Bson.BsonDateTime
    MongoDB.Bson.BsonDecimal128
    MongoDB.Bson.BsonDocument
    MongoDB.Bson.BsonDouble
    MongoDB.Bson.BsonInt32
    MongoDB.Bson.BsonInt64
    MongoDB.Bson.BsonJavaScript
    MongoDB.Bson.BsonMaxKey
    MongoDB.Bson.BsonMinKey
    MongoDB.Bson.BsonNull
    MongoDB.Bson.BsonObjectId
    MongoDB.Bson.BsonRegularExpression
    MongoDB.Bson.BsonString
    MongoDB.Bson.BsonSymbol
    MongoDB.Bson.BsonTimestamp
    MongoDB.Bson.BsonUndefined