I am working on an application in which the concept of direction (forward / backward) is very important.
The problem is that distribution throughout the code base consists of several different conventions: in some places it is true / false, and in others + 1 / -1.
To try to put this together, I created:
public class DirectionClass { public bool Forwards { get; set; } public double Sign { get; set; } public EDirection { get; set; }
Now I am 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);
and are there any classic gotchas that I probably get.
source share