I am trying to check this class: min >= max . I realized, using generics, I can not use comparators.
This is my common class.
public class Range<T> { public T MinValue { get; set; } public T MaxValue { get; set; } public Range() { } public Range(T min, T max) { this.MinValue = min; this.MaxValue = max; } public override bool Equals(object obj) { if (obj == null) return false; var other = obj as Range<T>; return this.MinValue.Equals(other.MinValue) && this.MaxValue.Equals(other.MaxValue); } public override string ToString() { return string.Format("{0},{1}", this.MinValue, this.MaxValue); } }
T data type can only be a number, is there a way to accept only numbers and accept <= ?
source share