Struct NpgsqlRange<T>
- Namespace
- NpgsqlTypes
- Assembly
- Npgsql.dll
Represents a PostgreSQL range type.
public readonly struct NpgsqlRange<T> : IEquatable<NpgsqlRange<T>>
Type Parameters
T
The element type of the values in the range.
- Implements
- Inherited Members
Remarks
Constructors
NpgsqlRange(T, bool, bool, T, bool, bool)
Constructs an NpgsqlRange<T>.
public NpgsqlRange(T lowerBound, bool lowerBoundIsInclusive, bool lowerBoundInfinite, T upperBound, bool upperBoundIsInclusive, bool upperBoundInfinite)
Parameters
lowerBound
TThe lower bound of the range.
lowerBoundIsInclusive
boolTrue if the lower bound is is part of the range (i.e. inclusive); otherwise, false.
lowerBoundInfinite
boolTrue if the lower bound is indefinite (i.e. infinite or unbounded); otherwise, false.
upperBound
TThe upper bound of the range.
upperBoundIsInclusive
boolTrue if the upper bound is part of the range (i.e. inclusive); otherwise, false.
upperBoundInfinite
boolTrue if the upper bound is indefinite (i.e. infinite or unbounded); otherwise, false.
NpgsqlRange(T, bool, T, bool)
Constructs an NpgsqlRange<T> with definite bounds.
public NpgsqlRange(T lowerBound, bool lowerBoundIsInclusive, T upperBound, bool upperBoundIsInclusive)
Parameters
lowerBound
TThe lower bound of the range.
lowerBoundIsInclusive
boolTrue if the lower bound is is part of the range (i.e. inclusive); otherwise, false.
upperBound
TThe upper bound of the range.
upperBoundIsInclusive
boolTrue if the upper bound is part of the range (i.e. inclusive); otherwise, false.
NpgsqlRange(T, T)
Constructs an NpgsqlRange<T> with inclusive and definite bounds.
public NpgsqlRange(T lowerBound, T upperBound)
Parameters
lowerBound
TThe lower bound of the range.
upperBound
TThe upper bound of the range.
Fields
Empty
Represents the empty range. This field is read-only.
public static readonly NpgsqlRange<T> Empty
Field Value
- NpgsqlRange<T>
Properties
IsEmpty
True if the range is empty; otherwise, false.
public bool IsEmpty { get; }
Property Value
LowerBound
The lower bound of the range. Only valid when LowerBoundInfinite is false.
public T LowerBound { get; }
Property Value
- T
LowerBoundInfinite
True if the lower bound is indefinite (i.e. infinite or unbounded); otherwise, false.
public bool LowerBoundInfinite { get; }
Property Value
LowerBoundIsInclusive
True if the lower bound is part of the range (i.e. inclusive); otherwise, false.
public bool LowerBoundIsInclusive { get; }
Property Value
UpperBound
The upper bound of the range. Only valid when UpperBoundInfinite is false.
public T UpperBound { get; }
Property Value
- T
UpperBoundInfinite
True if the upper bound is indefinite (i.e. infinite or unbounded); otherwise, false.
public bool UpperBoundInfinite { get; }
Property Value
UpperBoundIsInclusive
True if the upper bound is part of the range (i.e. inclusive); otherwise, false.
public bool UpperBoundIsInclusive { get; }
Property Value
Methods
Equals(NpgsqlRange<T>)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(NpgsqlRange<T> other)
Parameters
other
NpgsqlRange<T>An object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? o)
Parameters
o
object
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Parse(string)
Parses the well-known text representation of a PostgreSQL range type into a NpgsqlRange<T>.
public static NpgsqlRange<T> Parse(string value)
Parameters
value
stringA PosgreSQL range type in a well-known text format.
Returns
- NpgsqlRange<T>
The NpgsqlRange<T> represented by the
value
.
Remarks
Exceptions
- FormatException
Malformed range literal.
- FormatException
Malformed range literal. Missing left parenthesis or bracket.
- FormatException
Malformed range literal. Missing right parenthesis or bracket.
- FormatException
Malformed range literal. Missing comma after lower bound.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator ==(NpgsqlRange<T>, NpgsqlRange<T>)
Indicates whether the NpgsqlRange<T> on the left is equal to the NpgsqlRange<T> on the right.
public static bool operator ==(NpgsqlRange<T> x, NpgsqlRange<T> y)
Parameters
x
NpgsqlRange<T>The NpgsqlRange<T> on the left.
y
NpgsqlRange<T>The NpgsqlRange<T> on the right.
Returns
- bool
True if the NpgsqlRange<T> on the left is equal to the NpgsqlRange<T> on the right; otherwise, false.
operator !=(NpgsqlRange<T>, NpgsqlRange<T>)
Indicates whether the NpgsqlRange<T> on the left is not equal to the NpgsqlRange<T> on the right.
public static bool operator !=(NpgsqlRange<T> x, NpgsqlRange<T> y)
Parameters
x
NpgsqlRange<T>The NpgsqlRange<T> on the left.
y
NpgsqlRange<T>The NpgsqlRange<T> on the right.
Returns
- bool
True if the NpgsqlRange<T> on the left is not equal to the NpgsqlRange<T> on the right; otherwise, false.