I\'m implementing value types which represents a distance (or length). There\'s an enum that represents the different units of measure, eg:
public enum Distance
Generally speaking, I would go with Anton's solution. But if your implementation can't use that, and you need things to be used similar to an enum, I think this is a natural way to use the units:
DistanceUnit.Metric.Millimeter
DistanceUnit.Imperial.Inch
In order to use it like that, there should be:
public static class DistanceUnit
{
public static MetricDistanceUnit Metric;
public static ImperialDistanceUnit Imperial;
}
Where MetricDistanceUnit
is:
public enum MetricDistanceUnit
{
Millimeter, Centimeter ...
}
And ImperialDistanceUnit
has the same structure..