I'm working on an application where the notion of Direction (forwards/backwards) is very important.
The problem is that spread throughout the code base there are several different conventions: in some places it is true/false, and in others +1/-1.
To try and bring this together, I created:
public class DirectionClass
{
public bool Forwards { get; set; }
public double Sign { get; set; }
public EDirection { get; set; }
//plus associated constructor overloads, implementing IEquatable, etc.
}
I'm now wondering if implicit conversions would be a good or bad idea:
public static implicit operator DirectionClass(double sign);
public static implicit operator DirectionClass(bool forwards); //etc..
and whether there are classic gotchas which I am likely to encouter.