Let say I have the following class:
public sealed class ScaleValue :
IComparable, IComparable<ScaleValue>, IEquatable<ScaleValue>
{
public double Value
{ get; set;}
public string Definition
{ get; set;}
// interface methods
...
}
If I want to make my class comparable to a double
should I just include IComparable<double>
and implement it that way or do I have to do it another way?
And when I want my class to be comparable to doubles should the double.CompareTo
give the same result as the ScaleValue.CompareTo
?
and how about Equals
?
I think I put the responsibilities wrong in my design.
I think my best option is to make a Scale class with a ContainsValue(double Value)
method.
This way I can look up the value and keep the responsibilities where they are needed.