Class Range<TValue>
Represents a range of values defined by an inclusive lower and upper bounds.
Implements
Inherited Members
Namespace: Bonsai
Assembly: Bonsai.Core.dll
Syntax
public sealed class Range<TValue> : IEquatable<Range<TValue>>
Type Parameters
Name | Description |
---|---|
TValue | The type of values in the range. |
Constructors
| Improve this Doc View SourceRange(TValue, TValue)
Initializes a new instance of the Range<TValue> class with the specified lower and upper bounds.
Declaration
public Range(TValue lowerBound, TValue upperBound)
Parameters
Type | Name | Description |
---|---|---|
TValue | lowerBound | The inclusive lower bound of the range. |
TValue | upperBound | The inclusive upper bound of the range. |
Range(TValue, TValue, IComparer<TValue>)
Initializes a new instance of the Range<TValue> class with the specified lower and upper bounds and using the specified comparer.
Declaration
public Range(TValue lowerBound, TValue upperBound, IComparer<TValue> comparer)
Parameters
Type | Name | Description |
---|---|---|
TValue | lowerBound | The inclusive lower bound of the range. |
TValue | upperBound | The inclusive upper bound of the range. |
IComparer<TValue> | comparer | An IComparer<T> to use to compare values. |
Properties
| Improve this Doc View SourceLowerBound
Gets the inclusive lower bound of the range.
Declaration
public TValue LowerBound { get; }
Property Value
Type | Description |
---|---|
TValue |
UpperBound
Gets the inclusive upper bound of the range.
Declaration
public TValue UpperBound { get; }
Property Value
Type | Description |
---|---|
TValue |
Methods
| Improve this Doc View SourceContains(TValue)
Tests whether a specified value falls within the range.
Declaration
public bool Contains(TValue value)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The value to test. |
Returns
Type | Description |
---|---|
Boolean | true if |
Equals(Range<TValue>)
Returns a value indicating whether this instance has the same lower and upper bounds as a specified Range<TValue> object.
Declaration
public bool Equals(Range<TValue> other)
Parameters
Type | Name | Description |
---|---|---|
Range<TValue> | other | The Range<TValue> object to compare to this instance. |
Returns
Type | Description |
---|---|
Boolean | true if |
Equals(Object)
Tests to see whether the specified object is a Range<TValue> object with the same lower and upper bounds as this Range<TValue> instance.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to compare with this instance. |
Returns
Type | Description |
---|---|
Boolean | true if |
Overrides
| Improve this Doc View SourceGetHashCode()
Returns a hash code for the current instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | The hash code for the current instance. |
Overrides
| Improve this Doc View SourceToString()
Creates a String representation of this Range<TValue>.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | A String containing the lower and upper bound values of this Range<TValue>. |
Overrides
Operators
| Improve this Doc View SourceEquality(Range<TValue>, Range<TValue>)
Tests whether two Range<TValue> objects are equal.
Declaration
public static bool operator ==(Range<TValue> left, Range<TValue> right)
Parameters
Type | Name | Description |
---|---|---|
Range<TValue> | left | The Range<TValue> object on the left-hand side of the equality operator. |
Range<TValue> | right | The Range<TValue> object on the right-hand side of the equality operator. |
Returns
Type | Description |
---|---|
Boolean | true if |
Inequality(Range<TValue>, Range<TValue>)
Tests whether two Range<TValue> objects are different.
Declaration
public static bool operator !=(Range<TValue> left, Range<TValue> right)
Parameters
Type | Name | Description |
---|---|---|
Range<TValue> | left | The Range<TValue> object on the left-hand side of the inequality operator. |
Range<TValue> | right | The Range<TValue> object on the right-hand side of the inequality operator. |
Returns
Type | Description |
---|---|
Boolean | true if |