Table of Contents

Class BsonString

Namespace
MongoDB.Bson
Assembly
MongoDB.Bson.dll

Represents a BSON string value.

[Serializable]
public class BsonString : BsonValue, IComparable<BsonValue>, IConvertible, IEquatable<BsonValue>, IComparable<BsonString>, IEquatable<BsonString>
Inheritance
BsonString
Implements
Inherited Members
Extension Methods

Constructors

BsonString(string)

Initializes a new instance of the BsonString class.

public BsonString(string value)

Parameters

value string

The value.

Properties

BsonType

Gets the BsonType of this BsonValue.

public override BsonType BsonType { get; }

Property Value

BsonType

Empty

Gets an instance of BsonString that represents an empty string.

public static BsonString Empty { get; }

Property Value

BsonString

RawValue

Gets the BsonString as a string.

[Obsolete("Use Value instead.")]
public override object RawValue { get; }

Property Value

object

Value

Gets the value of this BsonString.

public string Value { get; }

Property Value

string

Methods

CompareTo(BsonString)

Compares this BsonString to another BsonString.

public int CompareTo(BsonString other)

Parameters

other BsonString

The other BsonString.

Returns

int

A 32-bit signed integer that indicates whether this BsonString is less than, equal to, or greather than the other.

CompareTo(BsonValue)

Compares the BsonString to another BsonValue.

public override int CompareTo(BsonValue other)

Parameters

other BsonValue

The other BsonValue.

Returns

int

A 32-bit signed integer that indicates whether this BsonString is less than, equal to, or greather than the other BsonValue.

Create(object)

Creates a new BsonString.

public static BsonString Create(object value)

Parameters

value object

An object to be mapped to a BsonString.

Returns

BsonString

A BsonString or null.

Equals(BsonString)

Compares this BsonString to another BsonString.

public bool Equals(BsonString rhs)

Parameters

rhs BsonString

The other BsonString.

Returns

bool

True if the two BsonString values are equal.

Equals(object)

Compares this BsonString to another object.

public override bool Equals(object obj)

Parameters

obj object

The other object.

Returns

bool

True if the other object is a BsonString and equal to this one.

GetHashCode()

Gets the hash code.

public override int GetHashCode()

Returns

int

The hash code.

IConvertibleGetTypeCodeImplementation()

Implementation of the IConvertible GetTypeCode method.

protected override TypeCode IConvertibleGetTypeCodeImplementation()

Returns

TypeCode

The TypeCode.

IConvertibleToBooleanImplementation(IFormatProvider)

Implementation of the IConvertible ToBoolean method.

protected override bool IConvertibleToBooleanImplementation(IFormatProvider provider)

Parameters

provider IFormatProvider

The format provider.

Returns

bool

A bool.

IConvertibleToByteImplementation(IFormatProvider)

Implementation of the IConvertible ToByte method.

protected override byte IConvertibleToByteImplementation(IFormatProvider provider)

Parameters

provider IFormatProvider

The format provider.

Returns

byte

A byte.

IConvertibleToCharImplementation(IFormatProvider)

Implementation of the IConvertible ToChar method.

protected override char IConvertibleToCharImplementation(IFormatProvider provider)

Parameters

provider IFormatProvider

The format provider.

Returns

char

A char.

IConvertibleToDateTimeImplementation(IFormatProvider)

Implementation of the IConvertible ToDateTime method.

protected override DateTime IConvertibleToDateTimeImplementation(IFormatProvider provider)

Parameters

provider IFormatProvider

The format provider.

Returns

DateTime

A DateTime.

IConvertibleToDecimalImplementation(IFormatProvider)

Implementation of the IConvertible ToDecimal method.

protected override decimal IConvertibleToDecimalImplementation(IFormatProvider provider)

Parameters

provider IFormatProvider

The format provider.

Returns

decimal

A decimal.

IConvertibleToDoubleImplementation(IFormatProvider)

Implementation of the IConvertible ToDouble method.

protected override double IConvertibleToDoubleImplementation(IFormatProvider provider)

Parameters

provider IFormatProvider

The format provider.

Returns

double

A double.

IConvertibleToInt16Implementation(IFormatProvider)

Implementation of the IConvertible ToInt16 method.

protected override short IConvertibleToInt16Implementation(IFormatProvider provider)

Parameters

provider IFormatProvider

The format provider.

Returns

short

A short.

IConvertibleToInt32Implementation(IFormatProvider)

Implementation of the IConvertible ToInt32 method.

protected override int IConvertibleToInt32Implementation(IFormatProvider provider)

Parameters

provider IFormatProvider

The format provider.

Returns

int

An int.

IConvertibleToInt64Implementation(IFormatProvider)

Implementation of the IConvertible ToInt64 method.

protected override long IConvertibleToInt64Implementation(IFormatProvider provider)

Parameters

provider IFormatProvider

The format provider.

Returns

long

A long.

IConvertibleToSByteImplementation(IFormatProvider)

Implementation of the IConvertible ToSByte method.

protected override sbyte IConvertibleToSByteImplementation(IFormatProvider provider)

Parameters

provider IFormatProvider

The format provider.

Returns

sbyte

An sbyte.

IConvertibleToSingleImplementation(IFormatProvider)

Implementation of the IConvertible ToSingle method.

protected override float IConvertibleToSingleImplementation(IFormatProvider provider)

Parameters

provider IFormatProvider

The format provider.

Returns

float

A float.

IConvertibleToStringImplementation(IFormatProvider)

Implementation of the IConvertible ToString method.

protected override string IConvertibleToStringImplementation(IFormatProvider provider)

Parameters

provider IFormatProvider

The format provider.

Returns

string

A string.

IConvertibleToUInt16Implementation(IFormatProvider)

Implementation of the IConvertible ToUInt16 method.

protected override ushort IConvertibleToUInt16Implementation(IFormatProvider provider)

Parameters

provider IFormatProvider

The format provider.

Returns

ushort

A ushort.

IConvertibleToUInt32Implementation(IFormatProvider)

Implementation of the IConvertible ToUInt32 method.

protected override uint IConvertibleToUInt32Implementation(IFormatProvider provider)

Parameters

provider IFormatProvider

The format provider.

Returns

uint

A uint.

IConvertibleToUInt64Implementation(IFormatProvider)

Implementation of the IConvertible ToUInt64 method.

protected override ulong IConvertibleToUInt64Implementation(IFormatProvider provider)

Parameters

provider IFormatProvider

The format provider.

Returns

ulong

A ulong.

ToBoolean()

Converts this BsonValue to a Boolean (using the JavaScript definition of truthiness).

public override bool ToBoolean()

Returns

bool

A Boolean.

ToDecimal()

Converts this BsonValue to a Decimal.

public override decimal ToDecimal()

Returns

decimal

A Decimal.

ToDecimal128()

Converts this BsonValue to a Decimal128.

public override Decimal128 ToDecimal128()

Returns

Decimal128

A Decimal128.

ToDouble()

Converts this BsonValue to a Double.

public override double ToDouble()

Returns

double

A Double.

ToInt32()

Converts this BsonValue to an Int32.

public override int ToInt32()

Returns

int

An Int32.

ToInt64()

Converts this BsonValue to an Int64.

public override long ToInt64()

Returns

long

An Int32.

ToString()

Returns a string representation of the value.

public override string ToString()

Returns

string

A string representation of the value.

Operators

operator ==(BsonString, BsonString)

Compares two BsonString values.

public static bool operator ==(BsonString lhs, BsonString rhs)

Parameters

lhs BsonString

The first BsonString.

rhs BsonString

The other BsonString.

Returns

bool

True if the two BsonString values are equal according to ==.

implicit operator BsonString(string)

Converts a string to a BsonString.

public static implicit operator BsonString(string value)

Parameters

value string

A string.

Returns

BsonString

A BsonString.

operator !=(BsonString, BsonString)

Compares two BsonString values.

public static bool operator !=(BsonString lhs, BsonString rhs)

Parameters

lhs BsonString

The first BsonString.

rhs BsonString

The other BsonString.

Returns

bool

True if the two BsonString values are not equal according to ==.