Does .NET has Units conversion class? I need to convert inches to millimeters and vise versa.
No, you need to make one yourself, like this:
public class Length
{
private const double MillimetersPerInch = 25.4;
private double _Millimeters;
public static Length FromMillimeters(double mm)
{
return new Length { _Millimeters = mm };
}
public static Length FromInch(double inch)
{
return new Length { _Millimeters = inch * MillimetersPerInch };
}
public double Inch { get { return _Millimeters / MillimetersPerInch; } }
public double Millimeters { get { return _Millimeters; } }
}