Table of Contents

Class BsonRegularExpression

Namespace
MongoDB.Bson
Assembly
MongoDB.Bson.dll

Represents a BSON regular expression value.

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

Constructors

BsonRegularExpression(string)

Initializes a new instance of the BsonRegularExpression class.

public BsonRegularExpression(string pattern)

Parameters

pattern string

A regular expression pattern.

BsonRegularExpression(string, string)

Initializes a new instance of the BsonRegularExpression class.

public BsonRegularExpression(string pattern, string options)

Parameters

pattern string

A regular expression pattern.

options string

Regular expression options.

BsonRegularExpression(Regex)

Initializes a new instance of the BsonRegularExpression class.

public BsonRegularExpression(Regex regex)

Parameters

regex Regex

A Regex.

Properties

BsonType

Gets the BsonType of this BsonValue.

public override BsonType BsonType { get; }

Property Value

BsonType

Options

Gets the regular expression options.

public string Options { get; }

Property Value

string

Pattern

Gets the regular expression pattern.

public string Pattern { get; }

Property Value

string

Methods

CompareTo(BsonRegularExpression)

Compares this BsonRegularExpression to another BsonRegularExpression.

public int CompareTo(BsonRegularExpression other)

Parameters

other BsonRegularExpression

The other BsonRegularExpression.

Returns

int

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

CompareTo(BsonValue)

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

Create(object)

Creates a new BsonRegularExpression.

public static BsonRegularExpression Create(object value)

Parameters

value object

An object to be mapped to a BsonRegularExpression.

Returns

BsonRegularExpression

A BsonRegularExpression or null.

Equals(BsonRegularExpression)

Compares this BsonRegularExpression to another BsonRegularExpression.

public bool Equals(BsonRegularExpression rhs)

Parameters

rhs BsonRegularExpression

The other BsonRegularExpression.

Returns

bool

True if the two BsonRegularExpression values are equal.

Equals(object)

Compares this BsonRegularExpression to another object.

public override bool Equals(object obj)

Parameters

obj object

The other object.

Returns

bool

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

GetHashCode()

Gets the hash code.

public override int GetHashCode()

Returns

int

The hash code.

ToRegex()

Converts the BsonRegularExpression to a Regex.

public Regex ToRegex()

Returns

Regex

A Regex.

ToString()

Returns a string representation of the value.

public override string ToString()

Returns

string

A string representation of the value.

Operators

operator ==(BsonRegularExpression, BsonRegularExpression)

Compares two BsonRegularExpression values.

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

Parameters

lhs BsonRegularExpression

The first BsonRegularExpression.

rhs BsonRegularExpression

The other BsonRegularExpression.

Returns

bool

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

implicit operator BsonRegularExpression(string)

Converts a string to a BsonRegularExpression.

public static implicit operator BsonRegularExpression(string value)

Parameters

value string

A string.

Returns

BsonRegularExpression

A BsonRegularExpression.

implicit operator BsonRegularExpression(Regex)

Converts a Regex to a BsonRegularExpression.

public static implicit operator BsonRegularExpression(Regex value)

Parameters

value Regex

A Regex.

Returns

BsonRegularExpression

A BsonRegularExpression.

operator !=(BsonRegularExpression, BsonRegularExpression)

Compares two BsonRegularExpression values.

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

Parameters

lhs BsonRegularExpression

The first BsonRegularExpression.

rhs BsonRegularExpression

The other BsonRegularExpression.

Returns

bool

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