namespace VideoBrowser.Common { using System; using VideoBrowser.If; /// /// Defines the /// /// public struct Range : IRange where T : IComparable { #region Constructors /// /// Initializes a new instance of the class. /// /// The start. /// The end. public Range(T start, T end) { this.Start = start; this.End = end; } #endregion Constructors #region Properties /// /// Gets the End /// public T End { get; } /// /// Gets the Start /// public T Start { get; } #endregion Properties #region Methods /// /// The Equals /// /// The other /// The public bool Equals(IRange other) { return this.Start.Equals(other.Start) && this.End.Equals(other.End); } /// /// The Equals /// /// The /// The public override bool Equals(object obj) { return this == (Range)obj; } /// /// The GetHashCode /// /// The public override int GetHashCode() { var startHash = this.Start.GetHashCode(); var endHash = this.End.GetHashCode(); return startHash ^ (startHash << 8) ^ endHash ^ (endHash << 4); } /// /// The ToString /// /// The public override string ToString() { return $"Start:{this.Start};End:{this.End}"; } #endregion Methods /// /// Implements the operator ==. /// /// The left. /// The right. /// The result of the operator. public static bool operator ==(Range left, Range right) { return Equals(left.Start, right.Start) && Equals(left.End, right.End); } /// /// Implements the operator !=. /// /// The left. /// The right. /// The result of the operator. public static bool operator !=(Range left, Range right) { return !(left == right); } } }