Table of Contents

Struct BsonElement

Namespace
MongoDB.Bson
Assembly
MongoDB.Bson.dll

Represents a BSON element.

[Serializable]
public struct BsonElement : IComparable<BsonElement>, IEquatable<BsonElement>
Implements
Inherited Members
Extension Methods

Constructors

BsonElement(string, BsonValue)

Initializes a new instance of the BsonElement class.

public BsonElement(string name, BsonValue value)

Parameters

name string

The name of the element.

value BsonValue

The value of the element.

Properties

Name

Gets the name of the element.

public string Name { get; }

Property Value

string

Value

Gets or sets the value of the element.

public BsonValue Value { get; }

Property Value

BsonValue

Methods

Clone()

Creates a shallow clone of the element (see also DeepClone).

public BsonElement Clone()

Returns

BsonElement

A shallow clone of the element.

CompareTo(BsonElement)

Compares this BsonElement to another BsonElement.

public int CompareTo(BsonElement other)

Parameters

other BsonElement

The other BsonElement.

Returns

int

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

DeepClone()

Creates a deep clone of the element (see also Clone).

public BsonElement DeepClone()

Returns

BsonElement

A deep clone of the element.

Equals(BsonElement)

Compares this BsonElement to another BsonElement.

public bool Equals(BsonElement rhs)

Parameters

rhs BsonElement

The other BsonElement.

Returns

bool

True if the two BsonElement values are equal.

Equals(object)

Compares this BsonElement to another object.

public override bool Equals(object obj)

Parameters

obj object

The other object.

Returns

bool

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

GetHashCode()

Gets the hash code.

public override int GetHashCode()

Returns

int

The hash code.

ToString()

Returns a string representation of the value.

public override string ToString()

Returns

string

A string representation of the value.

Operators

operator ==(BsonElement, BsonElement)

Compares two BsonElements.

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

Parameters

lhs BsonElement

The first BsonElement.

rhs BsonElement

The other BsonElement.

Returns

bool

True if the two BsonElements are equal (or both null).

operator !=(BsonElement, BsonElement)

Compares two BsonElements.

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

Parameters

lhs BsonElement

The first BsonElement.

rhs BsonElement

The other BsonElement.

Returns

bool

True if the two BsonElements are not equal (or one is null and the other is not).