Class SourceRange
Represents an inclusive range.
Inheritance
System.Object
SourceRange
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Execution.dll
Syntax
public class SourceRange : IEquatable<SourceRange>
Constructors
|
Improve this Doc
View Source
SourceRange(Int32, Int32)
Create a new range from its inclusive bounds.
Declaration
public SourceRange(int min, int max)
Parameters
| Type |
Name |
Description |
| System.Int32 |
min |
|
| System.Int32 |
max |
|
Exceptions
| Type |
Condition |
| System.ArgumentOutOfRangeException |
Thrown if min is greater than max.
|
Properties
|
Improve this Doc
View Source
Max
Declaration
public int Max { get; set; }
Property Value
| Type |
Description |
| System.Int32 |
|
|
Improve this Doc
View Source
Min
Declaration
public int Min { get; set; }
Property Value
| Type |
Description |
| System.Int32 |
|
Methods
|
Improve this Doc
View Source
Contains(Int32)
Whether n is inside the range.
Declaration
public bool Contains(int n)
Parameters
| Type |
Name |
Description |
| System.Int32 |
n |
|
Returns
| Type |
Description |
| System.Boolean |
|
|
Improve this Doc
View Source
Equals(SourceRange)
Two ranges are equal if they represent the same range- that is, they have the same minimum and maximum.
Declaration
public bool Equals(SourceRange that)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
|
Improve this Doc
View Source
Equals(Object)
Two ranges are equal if they represent the same range- that is, they have the same minimum and maximum.
Declaration
public override bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| System.Object |
obj |
|
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
System.Object.Equals(System.Object)
|
Improve this Doc
View Source
GetHashCode()
Gets a hash code by xoring the min and max's hash codes.
Declaration
public override int GetHashCode()
Returns
| Type |
Description |
| System.Int32 |
|
Overrides
System.Object.GetHashCode()
|
Improve this Doc
View Source
ToString()
Returns a nice string representation like (Min, Max)
Declaration
public override string ToString()
Returns
| Type |
Description |
| System.String |
|
Overrides
System.Object.ToString()
Operators
|
Improve this Doc
View Source
Equality(SourceRange, SourceRange)
Two ranges are equal if they represent the same range- that is, they have the same minimum and maximum.
Declaration
public static bool operator ==(SourceRange a, SourceRange b)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
|
Improve this Doc
View Source
Implicit((Int32, Int32) to SourceRange)
A Range can be implicitly constructed from a tuple of two ints.
Declaration
public static implicit operator SourceRange((int, int) pair)
Parameters
| Type |
Name |
Description |
| System.ValueTuple<System.Int32, System.Int32> |
pair |
|
Returns
|
Improve this Doc
View Source
Inequality(SourceRange, SourceRange)
Two ranges are equal if and only if they represent the same range- that is, they have the same minimum and maximum.
Declaration
public static bool operator !=(SourceRange a, SourceRange b)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Implements
System.IEquatable<T>