Struct NpgsqlRange<T>
Represents a PostgreSQL range type.
Implements
Inherited Members
Namespace: NpgsqlTypes
Assembly: Npgsql.dll
Syntax
public readonly struct NpgsqlRange<T> : IEquatable<NpgsqlRange<T>>
Type Parameters
Name | Description |
---|---|
T | The element type of the values in the range. |
Remarks
Constructors
NpgsqlRange(T, T)
Constructs an NpgsqlRange<T> with inclusive and definite bounds.
Declaration
public NpgsqlRange(T lowerBound, T upperBound)
Parameters
Type | Name | Description |
---|---|---|
T | lowerBound | The lower bound of the range. |
T | upperBound | The upper bound of the range. |
NpgsqlRange(T, Boolean, T, Boolean)
Constructs an NpgsqlRange<T> with definite bounds.
Declaration
public NpgsqlRange(T lowerBound, bool lowerBoundIsInclusive, T upperBound, bool upperBoundIsInclusive)
Parameters
Type | Name | Description |
---|---|---|
T | lowerBound | The lower bound of the range. |
Boolean | lowerBoundIsInclusive | True if the lower bound is is part of the range (i.e. inclusive); otherwise, false. |
T | upperBound | The upper bound of the range. |
Boolean | upperBoundIsInclusive | True if the upper bound is part of the range (i.e. inclusive); otherwise, false. |
NpgsqlRange(T, Boolean, Boolean, T, Boolean, Boolean)
Constructs an NpgsqlRange<T>.
Declaration
public NpgsqlRange(T lowerBound, bool lowerBoundIsInclusive, bool lowerBoundInfinite, T upperBound, bool upperBoundIsInclusive, bool upperBoundInfinite)
Parameters
Type | Name | Description |
---|---|---|
T | lowerBound | The lower bound of the range. |
Boolean | lowerBoundIsInclusive | True if the lower bound is is part of the range (i.e. inclusive); otherwise, false. |
Boolean | lowerBoundInfinite | True if the lower bound is indefinite (i.e. infinite or unbounded); otherwise, false. |
T | upperBound | The upper bound of the range. |
Boolean | upperBoundIsInclusive | True if the upper bound is part of the range (i.e. inclusive); otherwise, false. |
Boolean | upperBoundInfinite | True if the upper bound is indefinite (i.e. infinite or unbounded); otherwise, false. |
Fields
Empty
Represents the empty range. This field is read-only.
Declaration
public static readonly NpgsqlRange<T> Empty
Field Value
Type | Description |
---|---|
NpgsqlRange<T> |
Properties
IsEmpty
True if the range is empty; otherwise, false.
Declaration
public readonly bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
Boolean |
LowerBound
The lower bound of the range. Only valid when LowerBoundInfinite is false.
Declaration
public readonly T LowerBound { get; }
Property Value
Type | Description |
---|---|
T |
LowerBoundInfinite
True if the lower bound is indefinite (i.e. infinite or unbounded); otherwise, false.
Declaration
public readonly bool LowerBoundInfinite { get; }
Property Value
Type | Description |
---|---|
Boolean |
LowerBoundIsInclusive
True if the lower bound is part of the range (i.e. inclusive); otherwise, false.
Declaration
public readonly bool LowerBoundIsInclusive { get; }
Property Value
Type | Description |
---|---|
Boolean |
UpperBound
The upper bound of the range. Only valid when UpperBoundInfinite is false.
Declaration
public readonly T UpperBound { get; }
Property Value
Type | Description |
---|---|
T |
UpperBoundInfinite
True if the upper bound is indefinite (i.e. infinite or unbounded); otherwise, false.
Declaration
public readonly bool UpperBoundInfinite { get; }
Property Value
Type | Description |
---|---|
Boolean |
UpperBoundIsInclusive
True if the upper bound is part of the range (i.e. inclusive); otherwise, false.
Declaration
public readonly bool UpperBoundIsInclusive { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
Equals(NpgsqlRange<T>)
Declaration
public readonly bool Equals(NpgsqlRange<T> other)
Parameters
Type | Name | Description |
---|---|---|
NpgsqlRange<T> | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Declaration
public override readonly bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
Object | o |
Returns
Type | Description |
---|---|
Boolean |
Overrides
GetHashCode()
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
Parse(String)
Parses the well-known text representation of a PostgreSQL range type into a NpgsqlRange<T>.
Declaration
public static NpgsqlRange<T> Parse(string value)
Parameters
Type | Name | Description |
---|---|---|
String | value | A PosgreSQL range type in a well-known text format. |
Returns
Type | Description |
---|---|
NpgsqlRange<T> | The NpgsqlRange<T> represented by the |
Remarks
Exceptions
Type | Condition |
---|---|
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()
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
String |
Overrides
Operators
Equality(NpgsqlRange<T>, NpgsqlRange<T>)
Indicates whether the NpgsqlRange<T> on the left is equal to the NpgsqlRange<T> on the right.
Declaration
public static bool operator ==(NpgsqlRange<T> x, NpgsqlRange<T> y)
Parameters
Type | Name | Description |
---|---|---|
NpgsqlRange<T> | x | The NpgsqlRange<T> on the left. |
NpgsqlRange<T> | y | The NpgsqlRange<T> on the right. |
Returns
Type | Description |
---|---|
Boolean | True if the NpgsqlRange<T> on the left is equal to the NpgsqlRange<T> on the right; otherwise, false. |
Inequality(NpgsqlRange<T>, NpgsqlRange<T>)
Indicates whether the NpgsqlRange<T> on the left is not equal to the NpgsqlRange<T> on the right.
Declaration
public static bool operator !=(NpgsqlRange<T> x, NpgsqlRange<T> y)
Parameters
Type | Name | Description |
---|---|---|
NpgsqlRange<T> | x | The NpgsqlRange<T> on the left. |
NpgsqlRange<T> | y | The NpgsqlRange<T> on the right. |
Returns
Type | Description |
---|---|
Boolean | True if the NpgsqlRange<T> on the left is not equal to the NpgsqlRange<T> on the right; otherwise, false. |