Class BsonRegularExpression
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
stringA regular expression pattern.
BsonRegularExpression(string, string)
Initializes a new instance of the BsonRegularExpression class.
public BsonRegularExpression(string pattern, string options)
Parameters
BsonRegularExpression(Regex)
Initializes a new instance of the BsonRegularExpression class.
public BsonRegularExpression(Regex regex)
Parameters
regex
RegexA Regex.
Properties
BsonType
Gets the BsonType of this BsonValue.
public override BsonType BsonType { get; }
Property Value
Options
Gets the regular expression options.
public string Options { get; }
Property Value
Pattern
Gets the regular expression pattern.
public string Pattern { get; }
Property Value
Methods
CompareTo(BsonRegularExpression)
Compares this BsonRegularExpression to another BsonRegularExpression.
public int CompareTo(BsonRegularExpression other)
Parameters
other
BsonRegularExpressionThe 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
BsonValueThe 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
objectAn 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
BsonRegularExpressionThe 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
objectThe 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
BsonRegularExpressionThe first BsonRegularExpression.
rhs
BsonRegularExpressionThe 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
stringA string.
Returns
- BsonRegularExpression
A BsonRegularExpression.
implicit operator BsonRegularExpression(Regex)
Converts a Regex to a BsonRegularExpression.
public static implicit operator BsonRegularExpression(Regex value)
Parameters
value
RegexA Regex.
Returns
- BsonRegularExpression
A BsonRegularExpression.
operator !=(BsonRegularExpression, BsonRegularExpression)
Compares two BsonRegularExpression values.
public static bool operator !=(BsonRegularExpression lhs, BsonRegularExpression rhs)
Parameters
lhs
BsonRegularExpressionThe first BsonRegularExpression.
rhs
BsonRegularExpressionThe other BsonRegularExpression.
Returns
- bool
True if the two BsonRegularExpression values are not equal according to ==.