Class BsonValue
Represents a BSON value (this is an abstract class, see the various subclasses).
[Serializable]
public abstract class BsonValue : IComparable<BsonValue>, IConvertible, IEquatable<BsonValue>
- Inheritance
-
BsonValue
- Implements
- Derived
- Inherited Members
- Extension Methods
Properties
AsBoolean
Casts the BsonValue to a Boolean (throws an InvalidCastException if the cast is not valid).
public bool AsBoolean { get; }
Property Value
AsBsonArray
Casts the BsonValue to a BsonArray (throws an InvalidCastException if the cast is not valid).
public BsonArray AsBsonArray { get; }
Property Value
AsBsonBinaryData
Casts the BsonValue to a BsonBinaryData (throws an InvalidCastException if the cast is not valid).
public BsonBinaryData AsBsonBinaryData { get; }
Property Value
AsBsonDateTime
Casts the BsonValue to a BsonDateTime (throws an InvalidCastException if the cast is not valid).
public BsonDateTime AsBsonDateTime { get; }
Property Value
AsBsonDocument
Casts the BsonValue to a BsonDocument (throws an InvalidCastException if the cast is not valid).
public BsonDocument AsBsonDocument { get; }
Property Value
AsBsonJavaScript
Casts the BsonValue to a BsonJavaScript (throws an InvalidCastException if the cast is not valid).
public BsonJavaScript AsBsonJavaScript { get; }
Property Value
AsBsonJavaScriptWithScope
Casts the BsonValue to a BsonJavaScriptWithScope (throws an InvalidCastException if the cast is not valid).
public BsonJavaScriptWithScope AsBsonJavaScriptWithScope { get; }
Property Value
AsBsonMaxKey
Casts the BsonValue to a BsonMaxKey (throws an InvalidCastException if the cast is not valid).
public BsonMaxKey AsBsonMaxKey { get; }
Property Value
AsBsonMinKey
Casts the BsonValue to a BsonMinKey (throws an InvalidCastException if the cast is not valid).
public BsonMinKey AsBsonMinKey { get; }
Property Value
AsBsonNull
Casts the BsonValue to a BsonNull (throws an InvalidCastException if the cast is not valid).
public BsonNull AsBsonNull { get; }
Property Value
AsBsonRegularExpression
Casts the BsonValue to a BsonRegularExpression (throws an InvalidCastException if the cast is not valid).
public BsonRegularExpression AsBsonRegularExpression { get; }
Property Value
AsBsonSymbol
Casts the BsonValue to a BsonSymbol (throws an InvalidCastException if the cast is not valid).
public BsonSymbol AsBsonSymbol { get; }
Property Value
AsBsonTimestamp
Casts the BsonValue to a BsonTimestamp (throws an InvalidCastException if the cast is not valid).
public BsonTimestamp AsBsonTimestamp { get; }
Property Value
AsBsonUndefined
Casts the BsonValue to a BsonUndefined (throws an InvalidCastException if the cast is not valid).
public BsonUndefined AsBsonUndefined { get; }
Property Value
AsBsonValue
Casts the BsonValue to a BsonValue (a way of upcasting subclasses of BsonValue to BsonValue at compile time).
public BsonValue AsBsonValue { get; }
Property Value
AsByteArray
Casts the BsonValue to a Byte[] (throws an InvalidCastException if the cast is not valid).
public byte[] AsByteArray { get; }
Property Value
- byte[]
AsDateTime
Casts the BsonValue to a DateTime in UTC (throws an InvalidCastException if the cast is not valid).
[Obsolete("Use ToUniversalTime instead.")]
public DateTime AsDateTime { get; }
Property Value
AsDecimal
Casts the BsonValue to a decimal (throws an InvalidCastException if the cast is not valid).
public decimal AsDecimal { get; }
Property Value
AsDecimal128
Casts the BsonValue to a Decimal128 (throws an InvalidCastException if the cast is not valid).
public Decimal128 AsDecimal128 { get; }
Property Value
AsDouble
Casts the BsonValue to a Double (throws an InvalidCastException if the cast is not valid).
public double AsDouble { get; }
Property Value
AsGuid
Casts the BsonValue to a Guid (throws an InvalidCastException if the cast is not valid).
public Guid AsGuid { get; }
Property Value
AsInt32
Casts the BsonValue to an Int32 (throws an InvalidCastException if the cast is not valid).
public int AsInt32 { get; }
Property Value
AsInt64
Casts the BsonValue to a Int64 (throws an InvalidCastException if the cast is not valid).
public long AsInt64 { get; }
Property Value
AsLocalTime
Casts the BsonValue to a DateTime in the local timezone (throws an InvalidCastException if the cast is not valid).
[Obsolete("Use ToLocalTime instead.")]
public DateTime AsLocalTime { get; }
Property Value
AsNullableBoolean
Casts the BsonValue to a Nullable{Boolean} (throws an InvalidCastException if the cast is not valid).
public bool? AsNullableBoolean { get; }
Property Value
- bool?
AsNullableDateTime
Casts the BsonValue to a Nullable{DateTime} (throws an InvalidCastException if the cast is not valid).
[Obsolete("Use ToNullableUniversalTime instead.")]
public DateTime? AsNullableDateTime { get; }
Property Value
AsNullableDecimal
Casts the BsonValue to a Nullable{Decimal} (throws an InvalidCastException if the cast is not valid).
public decimal? AsNullableDecimal { get; }
Property Value
AsNullableDecimal128
Casts the BsonValue to a Nullable{Decimal128} (throws an InvalidCastException if the cast is not valid).
public Decimal128? AsNullableDecimal128 { get; }
Property Value
AsNullableDouble
Casts the BsonValue to a Nullable{Double} (throws an InvalidCastException if the cast is not valid).
public double? AsNullableDouble { get; }
Property Value
AsNullableGuid
Casts the BsonValue to a Nullable{Guid} (throws an InvalidCastException if the cast is not valid).
public Guid? AsNullableGuid { get; }
Property Value
- Guid?
AsNullableInt32
Casts the BsonValue to a Nullable{Int32} (throws an InvalidCastException if the cast is not valid).
public int? AsNullableInt32 { get; }
Property Value
- int?
AsNullableInt64
Casts the BsonValue to a Nullable{Int64} (throws an InvalidCastException if the cast is not valid).
public long? AsNullableInt64 { get; }
Property Value
- long?
AsNullableObjectId
Casts the BsonValue to a Nullable{ObjectId} (throws an InvalidCastException if the cast is not valid).
public ObjectId? AsNullableObjectId { get; }
Property Value
AsObjectId
Casts the BsonValue to an ObjectId (throws an InvalidCastException if the cast is not valid).
public ObjectId AsObjectId { get; }
Property Value
AsRegex
Casts the BsonValue to a Regex (throws an InvalidCastException if the cast is not valid).
public Regex AsRegex { get; }
Property Value
AsString
Casts the BsonValue to a String (throws an InvalidCastException if the cast is not valid).
public string AsString { get; }
Property Value
AsUniversalTime
Casts the BsonValue to a DateTime in UTC (throws an InvalidCastException if the cast is not valid).
[Obsolete("Use ToUniversalTime instead.")]
public DateTime AsUniversalTime { get; }
Property Value
BsonType
Gets the BsonType of this BsonValue.
public abstract BsonType BsonType { get; }
Property Value
IsBoolean
Tests whether this BsonValue is a Boolean.
public bool IsBoolean { get; }
Property Value
IsBsonArray
Tests whether this BsonValue is a BsonArray.
public bool IsBsonArray { get; }
Property Value
IsBsonBinaryData
Tests whether this BsonValue is a BsonBinaryData.
public bool IsBsonBinaryData { get; }
Property Value
IsBsonDateTime
Tests whether this BsonValue is a BsonDateTime.
public bool IsBsonDateTime { get; }
Property Value
IsBsonDocument
Tests whether this BsonValue is a BsonDocument.
public bool IsBsonDocument { get; }
Property Value
IsBsonJavaScript
Tests whether this BsonValue is a BsonJavaScript.
public bool IsBsonJavaScript { get; }
Property Value
IsBsonJavaScriptWithScope
Tests whether this BsonValue is a BsonJavaScriptWithScope.
public bool IsBsonJavaScriptWithScope { get; }
Property Value
IsBsonMaxKey
Tests whether this BsonValue is a BsonMaxKey.
public bool IsBsonMaxKey { get; }
Property Value
IsBsonMinKey
Tests whether this BsonValue is a BsonMinKey.
public bool IsBsonMinKey { get; }
Property Value
IsBsonNull
Tests whether this BsonValue is a BsonNull.
public bool IsBsonNull { get; }
Property Value
IsBsonRegularExpression
Tests whether this BsonValue is a BsonRegularExpression.
public bool IsBsonRegularExpression { get; }
Property Value
IsBsonSymbol
Tests whether this BsonValue is a BsonSymbol .
public bool IsBsonSymbol { get; }
Property Value
IsBsonTimestamp
Tests whether this BsonValue is a BsonTimestamp.
public bool IsBsonTimestamp { get; }
Property Value
IsBsonUndefined
Tests whether this BsonValue is a BsonUndefined.
public bool IsBsonUndefined { get; }
Property Value
IsDateTime
Tests whether this BsonValue is a DateTime.
[Obsolete("Use IsValidDateTime instead.")]
public bool IsDateTime { get; }
Property Value
IsDecimal128
Tests whether this BsonValue is a Decimal128.
public bool IsDecimal128 { get; }
Property Value
IsDouble
Tests whether this BsonValue is a Double.
public bool IsDouble { get; }
Property Value
IsGuid
Tests whether this BsonValue is a Guid.
public bool IsGuid { get; }
Property Value
IsInt32
Tests whether this BsonValue is an Int32.
public bool IsInt32 { get; }
Property Value
IsInt64
Tests whether this BsonValue is an Int64.
public bool IsInt64 { get; }
Property Value
IsNumeric
Tests whether this BsonValue is a numeric value.
public bool IsNumeric { get; }
Property Value
IsObjectId
Tests whether this BsonValue is an ObjectId .
public bool IsObjectId { get; }
Property Value
IsString
Tests whether this BsonValue is a String.
public bool IsString { get; }
Property Value
IsValidDateTime
Tests whether this BsonValue is a valid DateTime.
public virtual bool IsValidDateTime { get; }
Property Value
this[int]
Gets or sets a value by position (only applies to BsonDocument and BsonArray).
public virtual BsonValue this[int index] { get; set; }
Parameters
index
intThe position.
Property Value
- BsonValue
The value.
this[string]
Gets or sets a value by name (only applies to BsonDocument).
public virtual BsonValue this[string name] { get; set; }
Parameters
name
stringThe name.
Property Value
- BsonValue
The value.
RawValue
Gets the raw value of this BsonValue (or null if this BsonValue doesn't have a single scalar value).
[Obsolete("Use Value property of subclasses or BsonTypeMapper.MapToDotNetValue instead.")]
public virtual object RawValue { get; }
Property Value
Methods
Clone()
Creates a shallow clone of the BsonValue (see also DeepClone).
public virtual BsonValue Clone()
Returns
- BsonValue
A shallow clone of the BsonValue.
CompareTo(BsonValue)
Compares this BsonValue to another BsonValue.
public abstract int CompareTo(BsonValue other)
Parameters
other
BsonValueThe other BsonValue.
Returns
- int
A 32-bit signed integer that indicates whether this BsonValue is less than, equal to, or greather than the other BsonValue.
CompareTypeTo(BsonValue)
Compares the type of this BsonValue to the type of another BsonValue.
public int CompareTypeTo(BsonValue other)
Parameters
other
BsonValueThe other BsonValue.
Returns
- int
A 32-bit signed integer that indicates whether the type of this BsonValue is less than, equal to, or greather than the type of the other BsonValue.
Create(object)
Creates a new instance of the BsonValue class.
public static BsonValue Create(object value)
Parameters
value
objectA value to be mapped to a BsonValue.
Returns
- BsonValue
A BsonValue.
DeepClone()
Creates a deep clone of the BsonValue (see also Clone).
public virtual BsonValue DeepClone()
Returns
- BsonValue
A deep clone of the BsonValue.
Equals(BsonValue)
Compares this BsonValue to another BsonValue.
public bool Equals(BsonValue rhs)
Parameters
rhs
BsonValueThe other BsonValue.
Returns
- bool
True if the two BsonValue values are equal.
Equals(object)
Compares this BsonValue to another object.
public override abstract bool Equals(object obj)
Parameters
obj
objectThe other object.
Returns
- bool
True if the other object is a BsonValue and equal to this one.
GetHashCode()
Gets the hash code.
public override abstract int GetHashCode()
Returns
- int
The hash code.
IConvertibleGetTypeCodeImplementation()
Implementation of the IConvertible GetTypeCode method.
protected virtual TypeCode IConvertibleGetTypeCodeImplementation()
Returns
- TypeCode
The TypeCode.
IConvertibleToBooleanImplementation(IFormatProvider)
Implementation of the IConvertible ToBoolean method.
protected virtual bool IConvertibleToBooleanImplementation(IFormatProvider provider)
Parameters
provider
IFormatProviderThe format provider.
Returns
- bool
A bool.
IConvertibleToByteImplementation(IFormatProvider)
Implementation of the IConvertible ToByte method.
protected virtual byte IConvertibleToByteImplementation(IFormatProvider provider)
Parameters
provider
IFormatProviderThe format provider.
Returns
- byte
A byte.
IConvertibleToCharImplementation(IFormatProvider)
Implementation of the IConvertible ToChar method.
protected virtual char IConvertibleToCharImplementation(IFormatProvider provider)
Parameters
provider
IFormatProviderThe format provider.
Returns
- char
A char.
IConvertibleToDateTimeImplementation(IFormatProvider)
Implementation of the IConvertible ToDateTime method.
protected virtual DateTime IConvertibleToDateTimeImplementation(IFormatProvider provider)
Parameters
provider
IFormatProviderThe format provider.
Returns
- DateTime
A DateTime.
IConvertibleToDecimalImplementation(IFormatProvider)
Implementation of the IConvertible ToDecimal method.
protected virtual decimal IConvertibleToDecimalImplementation(IFormatProvider provider)
Parameters
provider
IFormatProviderThe format provider.
Returns
- decimal
A decimal.
IConvertibleToDoubleImplementation(IFormatProvider)
Implementation of the IConvertible ToDouble method.
protected virtual double IConvertibleToDoubleImplementation(IFormatProvider provider)
Parameters
provider
IFormatProviderThe format provider.
Returns
- double
A double.
IConvertibleToInt16Implementation(IFormatProvider)
Implementation of the IConvertible ToInt16 method.
protected virtual short IConvertibleToInt16Implementation(IFormatProvider provider)
Parameters
provider
IFormatProviderThe format provider.
Returns
- short
A short.
IConvertibleToInt32Implementation(IFormatProvider)
Implementation of the IConvertible ToInt32 method.
protected virtual int IConvertibleToInt32Implementation(IFormatProvider provider)
Parameters
provider
IFormatProviderThe format provider.
Returns
- int
An int.
IConvertibleToInt64Implementation(IFormatProvider)
Implementation of the IConvertible ToInt64 method.
protected virtual long IConvertibleToInt64Implementation(IFormatProvider provider)
Parameters
provider
IFormatProviderThe format provider.
Returns
- long
A long.
IConvertibleToSByteImplementation(IFormatProvider)
Implementation of the IConvertible ToSByte method.
protected virtual sbyte IConvertibleToSByteImplementation(IFormatProvider provider)
Parameters
provider
IFormatProviderThe format provider.
Returns
- sbyte
An sbyte.
IConvertibleToSingleImplementation(IFormatProvider)
Implementation of the IConvertible ToSingle method.
protected virtual float IConvertibleToSingleImplementation(IFormatProvider provider)
Parameters
provider
IFormatProviderThe format provider.
Returns
- float
A float.
IConvertibleToStringImplementation(IFormatProvider)
Implementation of the IConvertible ToString method.
protected virtual string IConvertibleToStringImplementation(IFormatProvider provider)
Parameters
provider
IFormatProviderThe format provider.
Returns
- string
A string.
IConvertibleToUInt16Implementation(IFormatProvider)
Implementation of the IConvertible ToUInt16 method.
protected virtual ushort IConvertibleToUInt16Implementation(IFormatProvider provider)
Parameters
provider
IFormatProviderThe format provider.
Returns
- ushort
A ushort.
IConvertibleToUInt32Implementation(IFormatProvider)
Implementation of the IConvertible ToUInt32 method.
protected virtual uint IConvertibleToUInt32Implementation(IFormatProvider provider)
Parameters
provider
IFormatProviderThe format provider.
Returns
- uint
A uint.
IConvertibleToUInt64Implementation(IFormatProvider)
Implementation of the IConvertible ToUInt64 method.
protected virtual ulong IConvertibleToUInt64Implementation(IFormatProvider provider)
Parameters
provider
IFormatProviderThe format provider.
Returns
- ulong
A ulong.
OperatorEqualsImplementation(BsonValue)
Implementation of operator ==.
protected virtual bool OperatorEqualsImplementation(BsonValue rhs)
Parameters
rhs
BsonValueThe other BsonValue.
Returns
- bool
True if the two BsonValues are equal according to ==.
ToBoolean()
Converts this BsonValue to a Boolean (using the JavaScript definition of truthiness).
public virtual bool ToBoolean()
Returns
- bool
A Boolean.
ToDecimal()
Converts this BsonValue to a Decimal.
public virtual decimal ToDecimal()
Returns
- decimal
A Decimal.
ToDecimal128()
Converts this BsonValue to a Decimal128.
public virtual Decimal128 ToDecimal128()
Returns
- Decimal128
A Decimal128.
ToDouble()
Converts this BsonValue to a Double.
public virtual double ToDouble()
Returns
- double
A Double.
ToInt32()
Converts this BsonValue to an Int32.
public virtual int ToInt32()
Returns
- int
An Int32.
ToInt64()
Converts this BsonValue to an Int64.
public virtual long ToInt64()
Returns
- long
An Int64.
ToLocalTime()
Converts this BsonValue to a DateTime in local time.
public virtual DateTime ToLocalTime()
Returns
- DateTime
A DateTime.
ToNullableLocalTime()
Converts this BsonValue to a DateTime? in local time.
public virtual DateTime? ToNullableLocalTime()
Returns
- DateTime?
A DateTime?.
ToNullableUniversalTime()
Converts this BsonValue to a DateTime? in UTC.
public virtual DateTime? ToNullableUniversalTime()
Returns
- DateTime?
A DateTime?.
ToUniversalTime()
Converts this BsonValue to a DateTime in UTC.
public virtual DateTime ToUniversalTime()
Returns
- DateTime
A DateTime.
Operators
operator ==(BsonValue, BsonValue)
Compares two BsonValues.
public static bool operator ==(BsonValue lhs, BsonValue rhs)
Parameters
Returns
- bool
True if the two BsonValues are equal according to ==.
explicit operator Decimal128(BsonValue)
Casts a BsonValue to a Decimal128.
public static explicit operator Decimal128(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
explicit operator ObjectId(BsonValue)
Casts a BsonValue to an ObjectId.
public static explicit operator ObjectId(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- ObjectId
An ObjectId.
explicit operator bool(BsonValue)
Casts a BsonValue to a bool.
public static explicit operator bool(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- bool
A bool.
explicit operator byte[](BsonValue)
Casts a BsonValue to a byte[].
public static explicit operator byte[](BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- byte[]
A byte[].
explicit operator DateTime(BsonValue)
Casts a BsonValue to a DateTime.
public static explicit operator DateTime(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- DateTime
A DateTime.
explicit operator decimal(BsonValue)
Casts a BsonValue to a decimal.
public static explicit operator decimal(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- decimal
A decimal.
explicit operator double(BsonValue)
Casts a BsonValue to a double.
public static explicit operator double(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- double
A double.
explicit operator Guid(BsonValue)
Casts a BsonValue to a Guid.
public static explicit operator Guid(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- Guid
A Guid.
explicit operator int(BsonValue)
Casts a BsonValue to an int.
public static explicit operator int(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- int
An int.
explicit operator long(BsonValue)
Casts a BsonValue to a long.
public static explicit operator long(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- long
A long.
explicit operator Decimal128?(BsonValue)
Casts a BsonValue to a nullable Decimal128?.
public static explicit operator Decimal128?(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- Decimal128?
A nullable Decimal128.
explicit operator ObjectId?(BsonValue)
Casts a BsonValue to an ObjectId?.
public static explicit operator ObjectId?(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- ObjectId?
An ObjectId?.
explicit operator bool?(BsonValue)
Casts a BsonValue to a bool?.
public static explicit operator bool?(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- bool?
A bool?.
explicit operator DateTime?(BsonValue)
Casts a BsonValue to a DateTime?.
public static explicit operator DateTime?(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- DateTime?
A DateTime?.
explicit operator decimal?(BsonValue)
Casts a BsonValue to a decimal?.
public static explicit operator decimal?(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- decimal?
A decimal?.
explicit operator double?(BsonValue)
Casts a BsonValue to a double?.
public static explicit operator double?(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- double?
A double?.
explicit operator Guid?(BsonValue)
Casts a BsonValue to a Guid?.
public static explicit operator Guid?(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- Guid?
A Guid?.
explicit operator int?(BsonValue)
Casts a BsonValue to an int?.
public static explicit operator int?(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- int?
An int?.
explicit operator long?(BsonValue)
Casts a BsonValue to a long?.
public static explicit operator long?(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- long?
A long?.
explicit operator string(BsonValue)
Casts a BsonValue to a string.
public static explicit operator string(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- string
A string.
explicit operator Regex(BsonValue)
Casts a BsonValue to a Regex.
public static explicit operator Regex(BsonValue value)
Parameters
value
BsonValueThe BsonValue.
Returns
- Regex
A Regex.
operator >(BsonValue, BsonValue)
Compares two BsonValues.
public static bool operator >(BsonValue lhs, BsonValue rhs)
Parameters
Returns
- bool
True if the first BsonValue is greater than the other one.
operator >=(BsonValue, BsonValue)
Compares two BsonValues.
public static bool operator >=(BsonValue lhs, BsonValue rhs)
Parameters
Returns
- bool
True if the first BsonValue is greater than or equal to the other one.
implicit operator BsonValue(Decimal128)
Converts a Decimal128 to a BsonValue.
public static implicit operator BsonValue(Decimal128 value)
Parameters
value
Decimal128A Decimal128.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(ObjectId)
Converts an ObjectId to a BsonValue.
public static implicit operator BsonValue(ObjectId value)
Parameters
value
ObjectIdAn ObjectId.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(bool)
Converts a bool to a BsonValue.
public static implicit operator BsonValue(bool value)
Parameters
value
boolA bool.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(byte[])
Converts a byte[] to a BsonValue.
public static implicit operator BsonValue(byte[] value)
Parameters
value
byte[]A byte[].
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(DateTime)
Converts a DateTime to a BsonValue.
public static implicit operator BsonValue(DateTime value)
Parameters
value
DateTimeA DateTime.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(decimal)
Converts a decimal to a BsonValue.
public static implicit operator BsonValue(decimal value)
Parameters
value
decimalA decimal.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(double)
Converts a double to a BsonValue.
public static implicit operator BsonValue(double value)
Parameters
value
doubleA double.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(Enum)
Converts an Enum to a BsonValue.
public static implicit operator BsonValue(Enum value)
Parameters
value
EnumAn Enum.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(Guid)
Converts a Guid to a BsonValue.
[Obsolete("Use the BsonBinaryData constructor instead and specify a Guid representation.")]
public static implicit operator BsonValue(Guid value)
Parameters
value
GuidA Guid.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(int)
Converts an int to a BsonValue.
public static implicit operator BsonValue(int value)
Parameters
value
intAn int.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(long)
Converts a long to a BsonValue.
public static implicit operator BsonValue(long value)
Parameters
value
longA long.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(Decimal128?)
Converts a nullable Decimal128 to a BsonValue.
public static implicit operator BsonValue(Decimal128? value)
Parameters
value
Decimal128?A Decimal128?.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(ObjectId?)
Converts an ObjectId? to a BsonValue.
public static implicit operator BsonValue(ObjectId? value)
Parameters
value
ObjectId?An ObjectId?.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(bool?)
Converts a bool? to a BsonValue.
public static implicit operator BsonValue(bool? value)
Parameters
value
bool?A bool?.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(DateTime?)
Converts a DateTime? to a BsonValue.
public static implicit operator BsonValue(DateTime? value)
Parameters
value
DateTime?A DateTime?.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(decimal?)
Converts a decimal? to a BsonValue.
public static implicit operator BsonValue(decimal? value)
Parameters
value
decimal?A decimal?.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(double?)
Converts a double? to a BsonValue.
public static implicit operator BsonValue(double? value)
Parameters
value
double?A double?.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(Guid?)
Converts a Guid? to a BsonValue.
[Obsolete("Use the BsonBinaryData constructor instead and specify a Guid representation.")]
public static implicit operator BsonValue(Guid? value)
Parameters
value
Guid?A Guid?.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(int?)
Converts an int? to a BsonValue.
public static implicit operator BsonValue(int? value)
Parameters
value
int?An int?.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(long?)
Converts a long? to a BsonValue.
public static implicit operator BsonValue(long? value)
Parameters
value
long?A long?.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(string)
Converts a string to a BsonValue.
public static implicit operator BsonValue(string value)
Parameters
value
stringA string.
Returns
- BsonValue
A BsonValue.
implicit operator BsonValue(Regex)
Converts a Regex to a BsonValue.
public static implicit operator BsonValue(Regex value)
Parameters
value
RegexA Regex.
Returns
- BsonValue
A BsonValue.
operator !=(BsonValue, BsonValue)
Compares two BsonValues.
public static bool operator !=(BsonValue lhs, BsonValue rhs)
Parameters
Returns
- bool
True if the two BsonValues are not equal according to ==.
operator <(BsonValue, BsonValue)
Compares two BsonValues.
public static bool operator <(BsonValue lhs, BsonValue rhs)
Parameters
Returns
- bool
True if the first BsonValue is less than the other one.
operator <=(BsonValue, BsonValue)
Compares two BsonValues.
public static bool operator <=(BsonValue lhs, BsonValue rhs)
Parameters
Returns
- bool
True if the first BsonValue is less than or equal to the other one.