.net - How to implement Multi-type IComparable / IEquatable in C# -
let have following class: public sealed class scalevalue : icomparable, icomparable<scalevalue>, iequatable<scalevalue> { public double value { get; set;} public string definition { get; set;} // interface methods ... } if want make class comparable double should include icomparable<double> , implement way or have way? and when want class comparable doubles should double.compareto give same result scalevalue.compareto ? and how equals ? i think put responsibilities wrong in design. think best option make scale class containsvalue(double value) method. way can value , keep responsibilities needed. what class comparable you. make comparable anything , non-generic version of icomparable interface takes object ; in implementation of compareto method , can sniff type of object (unless null ). when use generic version of icomparable<t> , you're making statement implement strongly-typed comparison metho