# 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
  IEquatable<NpgsqlRange<T>>

Inherited Members
  object.Equals(object, object)
  object.GetType()
  object.ReferenceEquals(object, object)

## Remarks

See: https://www.postgresql.org/docs/current/static/rangetypes.html

## 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` T

  The lower bound of the range.

`lowerBoundIsInclusive` bool

  True if the lower bound is is part of the range (i.e. inclusive); otherwise, false.

`lowerBoundInfinite` bool

  True if the lower bound is indefinite (i.e. infinite or unbounded); otherwise, false.

`upperBound` T

  The upper bound of the range.

`upperBoundIsInclusive` bool

  True if the upper bound is part of the range (i.e. inclusive); otherwise, false.

`upperBoundInfinite` bool

  True 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` T

  The lower bound of the range.

`lowerBoundIsInclusive` bool

  True if the lower bound is is part of the range (i.e. inclusive); otherwise, false.

`upperBound` T

  The upper bound of the range.

`upperBoundIsInclusive` bool

  True 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` T

  The lower bound of the range.

`upperBound` T

  The 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

bool

### 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

bool

### LowerBoundIsInclusive

True if the lower bound is part of the range (i.e. inclusive); otherwise, false.

    public bool LowerBoundIsInclusive { get; }

#### Property Value

bool

### 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

bool

### UpperBoundIsInclusive

True if the upper bound is part of the range (i.e. inclusive); otherwise, false.

    public bool UpperBoundIsInclusive { get; }

#### Property Value

bool

## 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

bool

  true if the current object is equal to the `other` parameter; otherwise, false.

### 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` string

  A PosgreSQL range type in a well-known text format.

#### Returns

NpgsqlRange<T>

  The NpgsqlRange<T> represented by the `value`.

#### Remarks

See: https://www.postgresql.org/docs/current/static/rangetypes.html

#### 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.