MikeB
July 25th, 2007, 08:55 AM
I have a Unit class, where an object can support one or more formats.
[Flags()]
enum Format { Decimal = 1, Engineering = 2, Architectural = 4, Fractional = 8 };
The "Feet" units can support anyone of those formats:
Eg.: 1.5 feet can be seen as Decimal (1.5), Engineering (1'-6.0"),
Architectural (1'-6"), or Fractional (1 1/2).
In my class I have to variables
private Format _formats; // Supported formats
private Format _default; // Default format
How can I ensure that if the default is set, it can be set to only 1 flag value?
Mike B
[Flags()]
enum Format { Decimal = 1, Engineering = 2, Architectural = 4, Fractional = 8 };
The "Feet" units can support anyone of those formats:
Eg.: 1.5 feet can be seen as Decimal (1.5), Engineering (1'-6.0"),
Architectural (1'-6"), or Fractional (1 1/2).
In my class I have to variables
private Format _formats; // Supported formats
private Format _default; // Default format
How can I ensure that if the default is set, it can be set to only 1 flag value?
Mike B