Table of Contents

Class BsonInt32

Namespace
MongoDB.Bson
Assembly
MongoDB.Bson.dll

Represents a BSON int value.

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

Constructors

BsonInt32(int)

Creates a new instance of the BsonInt32 class.

public BsonInt32(int value)

Parameters

value int

The value.

Properties

BsonType

Gets the BsonType of this BsonValue.

public override BsonType BsonType { get; }

Property Value

BsonType

MinusOne

Gets an instance of BsonInt32 that represents -1.

[Obsolete("Use (BsonInt32)(-1) instead.")]
public static BsonInt32 MinusOne { get; }

Property Value

BsonInt32

One

Gets an instance of BsonInt32 that represents 1.

[Obsolete("Use (BsonInt32)1 instead.")]
public static BsonInt32 One { get; }

Property Value

BsonInt32

RawValue

Gets the BsonInt32 as an int.

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

Property Value

object

Three

Gets an instance of BsonInt32 that represents 3.

[Obsolete("Use (BsonInt32)3 instead.")]
public static BsonInt32 Three { get; }

Property Value

BsonInt32

Two

Gets an instance of BsonInt32 that represents 2.

[Obsolete("Use (BsonInt32)2 instead.")]
public static BsonInt32 Two { get; }

Property Value

BsonInt32

Value

Gets the value of this BsonInt32.

public int Value { get; }

Property Value

int

Zero

Gets an instance of BsonInt32 that represents -0.

[Obsolete("Use (BsonInt32)0 instead.")]
public static BsonInt32 Zero { get; }

Property Value

BsonInt32

Methods

CompareTo(BsonInt32)

Compares this BsonInt32 to another BsonInt32.

public int CompareTo(BsonInt32 other)

Parameters

other BsonInt32

The other BsonInt32.

Returns

int

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

CompareTo(BsonValue)

Compares the BsonInt32 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 BsonInt32 is less than, equal to, or greather than the other BsonValue.

Create(object)

Creates a new BsonInt32.

public static BsonInt32 Create(object value)

Parameters

value object

An object to be mapped to a BsonInt32.

Returns

BsonInt32

A BsonInt32 or null.

Equals(BsonInt32)

Compares this BsonInt32 to another BsonInt32.

public bool Equals(BsonInt32 rhs)

Parameters

rhs BsonInt32

The other BsonInt32.

Returns

bool

True if the two BsonInt32 values are equal.

Equals(object)

Compares this BsonInt32 to another object.

public override bool Equals(object obj)

Parameters

obj object

The other object.

Returns

bool

True if the other object is a BsonInt32 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.

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.

OperatorEqualsImplementation(BsonValue)

Compares this BsonInt32 against another BsonValue.

protected override bool OperatorEqualsImplementation(BsonValue rhs)

Parameters

rhs BsonValue

The other BsonValue.

Returns

bool

True if this BsonInt32 and the other BsonValue are equal according to ==.

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 ==(BsonInt32, BsonInt32)

Compares two BsonInt32 values.

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

Parameters

lhs BsonInt32

The first BsonInt32.

rhs BsonInt32

The other BsonInt32.

Returns

bool

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

implicit operator BsonInt32(int)

Converts an int to a BsonInt32.

public static implicit operator BsonInt32(int value)

Parameters

value int

An int.

Returns

BsonInt32

A BsonInt32.

operator !=(BsonInt32, BsonInt32)

Compares two BsonInt32 values.

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

Parameters

lhs BsonInt32

The first BsonInt32.

rhs BsonInt32

The other BsonInt32.

Returns

bool

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