BsonValue ClassMongoDB C# Driver API Documentation
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: { version: '1.11.0.92', semver: '1.11.0', commit: '791a16588d4a8b3b118a8b3b57cfa436fec5d3da', commitDate: '2015-12-08 22:55:45' }
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
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 methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOperatorEqualsImplementation
Implementation of operator ==.
Public methodStatic memberReadFrom Obsolete.
Reads one BsonValue from a BsonReader.
Public methodToBoolean
Converts this BsonValue to a Boolean (using the JavaScript definition of truthiness).
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.
Public methodWriteTo Obsolete.
Writes the BsonValue to a BsonWriter.
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 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(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)
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(NullableDouble to BsonValue)
Converts a double? to a BsonValue.
Public operatorStatic member(NullableGuid to BsonValue)
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(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(Type)Overloaded.
Converts an object to a BSON document byte array.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBson(Type, IBsonSerializationOptions)Overloaded.
Converts an object to a BSON document byte array.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBson(Type, BsonBinaryWriterSettings)Overloaded.
Converts an object to a BSON document byte array.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBson(Type, IBsonSerializationOptions, BsonBinaryWriterSettings)Overloaded.
Converts an object to a BSON document byte array.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBsonDocument(Type)Overloaded.
Converts an object to a BsonDocument.
(Defined by BsonExtensionMethods.)
Public Extension MethodToBsonDocument(Type, IBsonSerializationOptions)Overloaded.
Converts an object to a BsonDocument.
(Defined by BsonExtensionMethods.)
Public Extension MethodToJson(Type)Overloaded.
Converts an object to a JSON string.
(Defined by BsonExtensionMethods.)
Public Extension MethodToJson(Type, IBsonSerializationOptions)Overloaded.
Converts an object to a JSON string.
(Defined by BsonExtensionMethods.)
Public Extension MethodToJson(Type, JsonWriterSettings)Overloaded.
Converts an object to a JSON string.
(Defined by BsonExtensionMethods.)
Public Extension MethodToJson(Type, IBsonSerializationOptions, JsonWriterSettings)Overloaded.
Converts an object to a JSON string.
(Defined by BsonExtensionMethods.)
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 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 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 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
See Also

Reference

Inheritance Hierarchy

SystemObject
  MongoDB.BsonBsonValue
    MongoDB.BsonBsonArray
    MongoDB.BsonBsonBinaryData
    MongoDB.BsonBsonBoolean
    MongoDB.BsonBsonDateTime
    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