namespace HKW.HKWUtils; /// /// 可观察的范围 /// /// 类型 public class ObservableRange : ObservableClass>, IEquatable> { private T _min; public T Min { get => _min; set => SetProperty(ref _min, value); } private T _max; public T Max { get => _max; set => SetProperty(ref _max, value); } public ObservableRange() { } public ObservableRange(T min, T max) { _min = min; _max = max; } /// /// 复制一个新的对象 /// /// 新对象 public ObservableRange Copy() { return new(Min, Max); } #region Other /// public override int GetHashCode() { return HashCode.Combine(Min, Max); } /// public override bool Equals(object? obj) { return obj is ObservableRange temp && EqualityComparer.Default.Equals(Min, temp.Min) && EqualityComparer.Default.Equals(Max, temp.Max); } /// public bool Equals(ObservableRange? other) { return Equals(obj: other); } /// public static bool operator ==(ObservableRange a, ObservableRange b) { return Equals(a, b); } /// public static bool operator !=(ObservableRange a, ObservableRange b) { return Equals(a, b) is not true; } #endregion }