Static Readonly Field Value Gets Replaced

.Net 8 Blazor
Static Class, Static Fields

I am not sure what to call this issue, but I have a static read-only field where its value gets reflected as another value within the containing static class. I am not sure what would cause this or where to start looking. Any help would be appreciated.

See image of IntelliSense.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>public static class UnitOfMeasure
{
public static float MMToIn = (1 / 25.4F);
public static float inToMM = 25.4F;
public static readonly Unit Currency = new()
{
Name = "Currency",
DisplayName = "Currency",
Description = "Currency",
DefaultStep = .01F,
DefaultDecimalPlaces = CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalDigits,
DrawingPostFix = "",
ConversionFactor = 1
};
public static readonly Unit IN = new()
{
Name = "in",
DisplayName = "in",
Description = "inches",
DefaultStep = .001F,
DefaultDecimalPlaces = 4,
DrawingPostFix = "",
ConversionFactor = 1
};
public static readonly Unit MM = new()
{
Name = "mm",
DisplayName = "mm",
Description = "millimeter",
DefaultStep = .1F,
DefaultDecimalPlaces = 2,
DrawingPostFix = "",
ConversionFactor = MMToIn
};
public static readonly Unit SquareIN = new()
{
Name = "in²",
DisplayName = "in²",
Description = "inches squared",
DefaultStep = .001F,
DefaultDecimalPlaces = 5,
DrawingPostFix = "in²",
ConversionFactor = 1
};
public static readonly Unit SquareMM = new()
{
Name = "mm²",
DisplayName = "mm²",
Description = "inches squared",
DefaultStep = 1,
DefaultDecimalPlaces = 2,
DrawingPostFix = "mm²",
ConversionFactor = Pow(MMToIn, 2)
};
public static readonly Unit CubicIN = new()
{
Name = "in³",
DisplayName = "in³",
Description = "inches cubed",
DefaultStep = .001F,
DefaultDecimalPlaces = 5,
DrawingPostFix = "in³",
ConversionFactor = 1
};
public static readonly Unit CubicMM = new()
{
Name = "mm³",
DisplayName = "mm³",
Description = "inches cubed",
DefaultStep = 1,
DefaultDecimalPlaces = 2,
DrawingPostFix = "mm³",
ConversionFactor = Pow(MMToIn, 3)
};
public static readonly Unit L = new()
{
Name = "L",
DisplayName = "L",
Description = "Liters",
DefaultStep = .01F,
DefaultDecimalPlaces = 4,
DrawingPostFix = "L",
ConversionFactor = 1 / 0.01638706F
};
public static readonly Unit Gallon = new()
{
Name = "gal",
DisplayName = "gal",
Description = "Gallons",
DefaultStep = .01F,
DefaultDecimalPlaces = 4,
DrawingPostFix = "gal",
ConversionFactor = 1 / 0.004329F
};
public static readonly Unit ML = new()
{
Name = "ml",
DisplayName = "ml",
Description = "milliliters",
DefaultStep = .01F,
DefaultDecimalPlaces = 4,
DrawingPostFix = "ml",
ConversionFactor = 1 / 16.3871F
};
public static readonly Unit MG = new()
{
Name = "mg",
DisplayName = "mg",
Description = "milligrames",
DefaultStep = 1,
DefaultDecimalPlaces = 0,
DrawingPostFix = "mg",
ConversionFactor = 1
};
public static readonly Unit G = new()
{
Name = "g",
DisplayName = "g",
Description = "grames",
DefaultStep = .001F,
DefaultDecimalPlaces = 4,
DrawingPostFix = "g",
ConversionFactor = 1000
};
public static readonly Unit KG = new()
{
Name = "kg",
DisplayName = "kg",
Description = "kilogrames",
DefaultStep = .001F,
DefaultDecimalPlaces = 4,
DrawingPostFix = "kg",
ConversionFactor = 1000000
};
public static readonly Unit DEG = new()
{
Name = "deg",
DisplayName = "deg",
Description = "degrees",
DefaultStep = 1,
DefaultDecimalPlaces = 1,
DrawingPostFix = "˚",
ConversionFactor = PI / 180
};
public static readonly Unit Percent = new()
{
Name = "%",
DisplayName = "%",
Description = "percent",
DefaultStep = 1,
DefaultDecimalPlaces = 0,
DrawingPostFix = "",
ConversionFactor = 1
};
public static readonly Unit MGPerCubicIN = new()
{
Name = "mg/in³",
DisplayName = "mg/in³",
Description = "mg per inches cubed",
DefaultStep = .00001F,
DefaultDecimalPlaces = 0,
DrawingPostFix = "mg/in³",
ConversionFactor = 1
};
public static readonly Unit MGPerCubicMM = new()
{
Name = "mg/mm³",
DisplayName = "mg/mm³",
Description = "mg per inches cubed",
DefaultStep = .00001F,
DefaultDecimalPlaces = 2,
DrawingPostFix = "mg/mm³",
ConversionFactor = 1 / Pow(MMToIn, 3)
};
public static readonly Unit MGPerML = new()
{
Name = "mg/ml",
DisplayName = "mg/ml",
Description = "mg per milligrames",
DefaultStep = .00001F,
DefaultDecimalPlaces = 2,
DrawingPostFix = "mg/ml",
ConversionFactor = 1 * 16.3871F
};
public static readonly Unit GPerCubicIN = new()
{
Name = "g/in³",
DisplayName = "g/in³",
Description = "g per inches cubed",
DefaultStep = .00001F,
DefaultDecimalPlaces = 2,
DrawingPostFix = "g/in³",
ConversionFactor = 1000
};
public static readonly Unit GPerCubicMM = new()
{
Name = "g/mm³",
DisplayName = "g/mm³",
Description = "g per inches cubed",
DefaultStep = .00001F,
DefaultDecimalPlaces = 5,
DrawingPostFix = "g/mm³",
ConversionFactor = 1000 / Pow(MMToIn, 3)
};
public static readonly Unit GPerML = new()
{
Name = "g/ml",
DisplayName = "g/ml",
Description = "g per milligrames",
DefaultStep = .00001F,
DefaultDecimalPlaces = 4,
DrawingPostFix = "g/ml",
ConversionFactor = 1000 * 16.3871F
};
public static readonly Unit LBS = new()
{
Name = "LBS",
DisplayName = "LBS",
Description = "Pounds",
DefaultStep = 5,
DefaultDecimalPlaces = 2,
DrawingPostFix = "",
ConversionFactor = 1
};
public static readonly Unit Tons = new()
{
Name = "tons",
DisplayName = "tons",
Description = "Tons",
DefaultStep = .1F,
DefaultDecimalPlaces = 2,
DrawingPostFix = "",
ConversionFactor = 2000
};
public static readonly Unit kN = new()
{
Name = "kN",
DisplayName = "kN",
Description = "kilonewton",
DefaultStep = .1F,
DefaultDecimalPlaces = 2,
DrawingPostFix = "",
ConversionFactor = 1 / 0.00444822F
};
public static readonly Unit kP = new()
{
Name = "kP",
DisplayName = "kP",
Description = "kilopond",
DefaultStep = 10,
DefaultDecimalPlaces = 1,
DrawingPostFix = "",
ConversionFactor = 2.2046226219F
};
public static readonly Unit MPA = new()
{
Name = "MPa",
DisplayName = "MPa",
Description = "Megapascal",
DefaultStep = 10,
DefaultDecimalPlaces = 2,
DrawingPostFix = "",
ConversionFactor = 145
};
public static readonly Unit RPM = new()
{
Name = "RPM",
DisplayName = "RPM",
Description = "RPM",
DefaultStep = 1,
DefaultDecimalPlaces = 2,
DrawingPostFix = "",
ConversionFactor = 1
};
public static readonly Unit Hertz = new()
{
Name = "Hz",
DisplayName = "Hz",
Description = "Hz",
DefaultStep = 1,
DefaultDecimalPlaces = 3,
DrawingPostFix = "",
ConversionFactor = 60.0F
};
public static readonly Unit TPM = new()
{
Name = "TPM",
DisplayName = "Tablets Per Minute",
Description = "Tablets Per Minute",
DefaultStep = 1,
DefaultDecimalPlaces = 2,
DrawingPostFix = "",
ConversionFactor = 1
};
public static readonly Unit TPH = new()
{
Name = "TPH",
DisplayName = "Tablets Per Hour",
Description = "Tablets Per Hour",
DefaultStep = 1,
DefaultDecimalPlaces = 2,
DrawingPostFix = "",
ConversionFactor = 1
};
public static readonly Unit HR = new()
{
Name = "hr",
DisplayName = "hr",
Description = "hours",
DefaultStep = 1,
DefaultDecimalPlaces = 2,
DrawingPostFix = "",
ConversionFactor = 1
};
public static readonly Unit Tablets = new()
{
Name = "Tablets",
DisplayName = "Tablets",
Description = "Tablets",
DefaultStep = 1,
DefaultDecimalPlaces = 2,
DrawingPostFix = "",
ConversionFactor = 1,
ShowUOM = false
};
public static readonly Unit ToolStationQty = new()
{
Name = "ToolStationQty",
DisplayName = "Tool Station Qty",
Description = "Tool Station Qty",
DefaultStep = 1,
DefaultDecimalPlaces = 0,
DrawingPostFix = "",
ConversionFactor = 1
};
public static readonly Unit MainCompressionRollerQty = new()
{
Name = "MainCompressionRollerQty",
DisplayName = "Main Compression Rollers",
Description = "Main Compression Rollers",
DefaultStep = 1,
DefaultDecimalPlaces = 0,
DrawingPostFix = "",
ConversionFactor = 1
};
public static readonly Unit TipQty = new()
{
Name = "TipQty",
DisplayName = "Tip Qty",
Description = "Tip Qty",
DefaultStep = 1,
DefaultDecimalPlaces = 0,
DrawingPostFix = "",
ConversionFactor = 1
};
public static readonly Unit ThickToWidthRatio = new()
{
Name = "ThickToWidthRatio",
DisplayName = "Thickness To Width",
Description = "Thickness To Width",
DefaultStep = .01F,
DefaultDecimalPlaces = 2,
DrawingPostFix = "",
ConversionFactor = 1,
ShowUOM = false
};
public static readonly Unit CornerRadiusToWidth = new()
{
Name = "CornerRadiusToWidth",
DisplayName = "Corner Radius To Width",
Description = "Corner Radius To Width",
DefaultStep = .01F,
DefaultDecimalPlaces = 2,
DrawingPostFix = "",
ConversionFactor = 1,
ShowUOM = false
};
public static readonly Unit CupToThickRatio = new()
{
Name = "CupToThickRatio",
DisplayName = "Cup To Thickness",
Description = "Cup To Thickness",
DefaultStep = .01F,
DefaultDecimalPlaces = 2,
DrawingPostFix = "",
ConversionFactor = 1,
ShowUOM = false
};
public static readonly Unit LengthToWidthRatio = new()
{
Name = "LengthToWidthRatio",
DisplayName = "Length To Width",
Description = "Length To Width",
DefaultStep = .01F,
DefaultDecimalPlaces = 2,
DrawingPostFix = "",
ConversionFactor = 1,
ShowUOM = false
};
public static readonly Unit EndRadiusToWidthRatio = new()
{
Name = "EndRadiusToWidthRatio",
DisplayName = "End Radius To Width",
Description = "End Radius To Width",
DefaultStep = .01F,
DefaultDecimalPlaces = 2,
DrawingPostFix = "",
ConversionFactor = 1,
ShowUOM = false
};
public class Unit
{
public string Name { get; set; }
public string DisplayName { get; set; }
public string Description { get; set; }
public float DefaultStep { get; set; }
public int DefaultDecimalPlaces { get; set; }
public string DrawingPostFix { get; set; }
public float ConversionFactor { get; set; }
public bool ShowUOM { get; set; } = true;
public float Convert(Unit unitFrom, float value)
{
return (unitFrom.ConversionFactor / ConversionFactor) * value;
}
public static bool operator ==(Unit c1, Unit c2)
{
return c1?.Equals(c2) ?? false;
}
public static bool operator !=(Unit c1, Unit c2)
{
return !c1?.Equals(c2) ?? true;
}
public override bool Equals(object obj)
{
if (obj == null || GetType() != obj.GetType())
{
return false;
}
var objectToCompareWith = (Unit)obj;
return objectToCompareWith.Name == Name;
}
public override int GetHashCode()
{
return HashCode.Combine(Name);
}
}
}
</code>
<code>public static class UnitOfMeasure { public static float MMToIn = (1 / 25.4F); public static float inToMM = 25.4F; public static readonly Unit Currency = new() { Name = "Currency", DisplayName = "Currency", Description = "Currency", DefaultStep = .01F, DefaultDecimalPlaces = CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalDigits, DrawingPostFix = "", ConversionFactor = 1 }; public static readonly Unit IN = new() { Name = "in", DisplayName = "in", Description = "inches", DefaultStep = .001F, DefaultDecimalPlaces = 4, DrawingPostFix = "", ConversionFactor = 1 }; public static readonly Unit MM = new() { Name = "mm", DisplayName = "mm", Description = "millimeter", DefaultStep = .1F, DefaultDecimalPlaces = 2, DrawingPostFix = "", ConversionFactor = MMToIn }; public static readonly Unit SquareIN = new() { Name = "in²", DisplayName = "in²", Description = "inches squared", DefaultStep = .001F, DefaultDecimalPlaces = 5, DrawingPostFix = "in²", ConversionFactor = 1 }; public static readonly Unit SquareMM = new() { Name = "mm²", DisplayName = "mm²", Description = "inches squared", DefaultStep = 1, DefaultDecimalPlaces = 2, DrawingPostFix = "mm²", ConversionFactor = Pow(MMToIn, 2) }; public static readonly Unit CubicIN = new() { Name = "in³", DisplayName = "in³", Description = "inches cubed", DefaultStep = .001F, DefaultDecimalPlaces = 5, DrawingPostFix = "in³", ConversionFactor = 1 }; public static readonly Unit CubicMM = new() { Name = "mm³", DisplayName = "mm³", Description = "inches cubed", DefaultStep = 1, DefaultDecimalPlaces = 2, DrawingPostFix = "mm³", ConversionFactor = Pow(MMToIn, 3) }; public static readonly Unit L = new() { Name = "L", DisplayName = "L", Description = "Liters", DefaultStep = .01F, DefaultDecimalPlaces = 4, DrawingPostFix = "L", ConversionFactor = 1 / 0.01638706F }; public static readonly Unit Gallon = new() { Name = "gal", DisplayName = "gal", Description = "Gallons", DefaultStep = .01F, DefaultDecimalPlaces = 4, DrawingPostFix = "gal", ConversionFactor = 1 / 0.004329F }; public static readonly Unit ML = new() { Name = "ml", DisplayName = "ml", Description = "milliliters", DefaultStep = .01F, DefaultDecimalPlaces = 4, DrawingPostFix = "ml", ConversionFactor = 1 / 16.3871F }; public static readonly Unit MG = new() { Name = "mg", DisplayName = "mg", Description = "milligrames", DefaultStep = 1, DefaultDecimalPlaces = 0, DrawingPostFix = "mg", ConversionFactor = 1 }; public static readonly Unit G = new() { Name = "g", DisplayName = "g", Description = "grames", DefaultStep = .001F, DefaultDecimalPlaces = 4, DrawingPostFix = "g", ConversionFactor = 1000 }; public static readonly Unit KG = new() { Name = "kg", DisplayName = "kg", Description = "kilogrames", DefaultStep = .001F, DefaultDecimalPlaces = 4, DrawingPostFix = "kg", ConversionFactor = 1000000 }; public static readonly Unit DEG = new() { Name = "deg", DisplayName = "deg", Description = "degrees", DefaultStep = 1, DefaultDecimalPlaces = 1, DrawingPostFix = "˚", ConversionFactor = PI / 180 }; public static readonly Unit Percent = new() { Name = "%", DisplayName = "%", Description = "percent", DefaultStep = 1, DefaultDecimalPlaces = 0, DrawingPostFix = "", ConversionFactor = 1 }; public static readonly Unit MGPerCubicIN = new() { Name = "mg/in³", DisplayName = "mg/in³", Description = "mg per inches cubed", DefaultStep = .00001F, DefaultDecimalPlaces = 0, DrawingPostFix = "mg/in³", ConversionFactor = 1 }; public static readonly Unit MGPerCubicMM = new() { Name = "mg/mm³", DisplayName = "mg/mm³", Description = "mg per inches cubed", DefaultStep = .00001F, DefaultDecimalPlaces = 2, DrawingPostFix = "mg/mm³", ConversionFactor = 1 / Pow(MMToIn, 3) }; public static readonly Unit MGPerML = new() { Name = "mg/ml", DisplayName = "mg/ml", Description = "mg per milligrames", DefaultStep = .00001F, DefaultDecimalPlaces = 2, DrawingPostFix = "mg/ml", ConversionFactor = 1 * 16.3871F }; public static readonly Unit GPerCubicIN = new() { Name = "g/in³", DisplayName = "g/in³", Description = "g per inches cubed", DefaultStep = .00001F, DefaultDecimalPlaces = 2, DrawingPostFix = "g/in³", ConversionFactor = 1000 }; public static readonly Unit GPerCubicMM = new() { Name = "g/mm³", DisplayName = "g/mm³", Description = "g per inches cubed", DefaultStep = .00001F, DefaultDecimalPlaces = 5, DrawingPostFix = "g/mm³", ConversionFactor = 1000 / Pow(MMToIn, 3) }; public static readonly Unit GPerML = new() { Name = "g/ml", DisplayName = "g/ml", Description = "g per milligrames", DefaultStep = .00001F, DefaultDecimalPlaces = 4, DrawingPostFix = "g/ml", ConversionFactor = 1000 * 16.3871F }; public static readonly Unit LBS = new() { Name = "LBS", DisplayName = "LBS", Description = "Pounds", DefaultStep = 5, DefaultDecimalPlaces = 2, DrawingPostFix = "", ConversionFactor = 1 }; public static readonly Unit Tons = new() { Name = "tons", DisplayName = "tons", Description = "Tons", DefaultStep = .1F, DefaultDecimalPlaces = 2, DrawingPostFix = "", ConversionFactor = 2000 }; public static readonly Unit kN = new() { Name = "kN", DisplayName = "kN", Description = "kilonewton", DefaultStep = .1F, DefaultDecimalPlaces = 2, DrawingPostFix = "", ConversionFactor = 1 / 0.00444822F }; public static readonly Unit kP = new() { Name = "kP", DisplayName = "kP", Description = "kilopond", DefaultStep = 10, DefaultDecimalPlaces = 1, DrawingPostFix = "", ConversionFactor = 2.2046226219F }; public static readonly Unit MPA = new() { Name = "MPa", DisplayName = "MPa", Description = "Megapascal", DefaultStep = 10, DefaultDecimalPlaces = 2, DrawingPostFix = "", ConversionFactor = 145 }; public static readonly Unit RPM = new() { Name = "RPM", DisplayName = "RPM", Description = "RPM", DefaultStep = 1, DefaultDecimalPlaces = 2, DrawingPostFix = "", ConversionFactor = 1 }; public static readonly Unit Hertz = new() { Name = "Hz", DisplayName = "Hz", Description = "Hz", DefaultStep = 1, DefaultDecimalPlaces = 3, DrawingPostFix = "", ConversionFactor = 60.0F }; public static readonly Unit TPM = new() { Name = "TPM", DisplayName = "Tablets Per Minute", Description = "Tablets Per Minute", DefaultStep = 1, DefaultDecimalPlaces = 2, DrawingPostFix = "", ConversionFactor = 1 }; public static readonly Unit TPH = new() { Name = "TPH", DisplayName = "Tablets Per Hour", Description = "Tablets Per Hour", DefaultStep = 1, DefaultDecimalPlaces = 2, DrawingPostFix = "", ConversionFactor = 1 }; public static readonly Unit HR = new() { Name = "hr", DisplayName = "hr", Description = "hours", DefaultStep = 1, DefaultDecimalPlaces = 2, DrawingPostFix = "", ConversionFactor = 1 }; public static readonly Unit Tablets = new() { Name = "Tablets", DisplayName = "Tablets", Description = "Tablets", DefaultStep = 1, DefaultDecimalPlaces = 2, DrawingPostFix = "", ConversionFactor = 1, ShowUOM = false }; public static readonly Unit ToolStationQty = new() { Name = "ToolStationQty", DisplayName = "Tool Station Qty", Description = "Tool Station Qty", DefaultStep = 1, DefaultDecimalPlaces = 0, DrawingPostFix = "", ConversionFactor = 1 }; public static readonly Unit MainCompressionRollerQty = new() { Name = "MainCompressionRollerQty", DisplayName = "Main Compression Rollers", Description = "Main Compression Rollers", DefaultStep = 1, DefaultDecimalPlaces = 0, DrawingPostFix = "", ConversionFactor = 1 }; public static readonly Unit TipQty = new() { Name = "TipQty", DisplayName = "Tip Qty", Description = "Tip Qty", DefaultStep = 1, DefaultDecimalPlaces = 0, DrawingPostFix = "", ConversionFactor = 1 }; public static readonly Unit ThickToWidthRatio = new() { Name = "ThickToWidthRatio", DisplayName = "Thickness To Width", Description = "Thickness To Width", DefaultStep = .01F, DefaultDecimalPlaces = 2, DrawingPostFix = "", ConversionFactor = 1, ShowUOM = false }; public static readonly Unit CornerRadiusToWidth = new() { Name = "CornerRadiusToWidth", DisplayName = "Corner Radius To Width", Description = "Corner Radius To Width", DefaultStep = .01F, DefaultDecimalPlaces = 2, DrawingPostFix = "", ConversionFactor = 1, ShowUOM = false }; public static readonly Unit CupToThickRatio = new() { Name = "CupToThickRatio", DisplayName = "Cup To Thickness", Description = "Cup To Thickness", DefaultStep = .01F, DefaultDecimalPlaces = 2, DrawingPostFix = "", ConversionFactor = 1, ShowUOM = false }; public static readonly Unit LengthToWidthRatio = new() { Name = "LengthToWidthRatio", DisplayName = "Length To Width", Description = "Length To Width", DefaultStep = .01F, DefaultDecimalPlaces = 2, DrawingPostFix = "", ConversionFactor = 1, ShowUOM = false }; public static readonly Unit EndRadiusToWidthRatio = new() { Name = "EndRadiusToWidthRatio", DisplayName = "End Radius To Width", Description = "End Radius To Width", DefaultStep = .01F, DefaultDecimalPlaces = 2, DrawingPostFix = "", ConversionFactor = 1, ShowUOM = false }; public class Unit { public string Name { get; set; } public string DisplayName { get; set; } public string Description { get; set; } public float DefaultStep { get; set; } public int DefaultDecimalPlaces { get; set; } public string DrawingPostFix { get; set; } public float ConversionFactor { get; set; } public bool ShowUOM { get; set; } = true; public float Convert(Unit unitFrom, float value) { return (unitFrom.ConversionFactor / ConversionFactor) * value; } public static bool operator ==(Unit c1, Unit c2) { return c1?.Equals(c2) ?? false; } public static bool operator !=(Unit c1, Unit c2) { return !c1?.Equals(c2) ?? true; } public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return false; } var objectToCompareWith = (Unit)obj; return objectToCompareWith.Name == Name; } public override int GetHashCode() { return HashCode.Combine(Name); } } } </code>
public static class UnitOfMeasure
{
    public static float MMToIn = (1 / 25.4F);
    public static float inToMM = 25.4F;

    public static readonly Unit Currency = new()
    {
        Name = "Currency",
        DisplayName = "Currency",
        Description = "Currency",
        DefaultStep = .01F,
        DefaultDecimalPlaces = CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalDigits,
        DrawingPostFix = "",
        ConversionFactor = 1
    };

    public static readonly Unit IN = new()
    {
        Name = "in",
        DisplayName = "in",
        Description = "inches",
        DefaultStep = .001F,
        DefaultDecimalPlaces = 4,
        DrawingPostFix = "",
        ConversionFactor = 1
    };

    public static readonly Unit MM = new()
    {
        Name = "mm",
        DisplayName = "mm",
        Description = "millimeter",
        DefaultStep = .1F,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "",
        ConversionFactor = MMToIn
    };

    public static readonly Unit SquareIN = new()
    {
        Name = "in²",
        DisplayName = "in²",
        Description = "inches squared",
        DefaultStep = .001F,
        DefaultDecimalPlaces = 5,
        DrawingPostFix = "in²",
        ConversionFactor = 1
    };

    public static readonly Unit SquareMM = new()
    {
        Name = "mm²",
        DisplayName = "mm²",
        Description = "inches squared",
        DefaultStep = 1,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "mm²",
        ConversionFactor = Pow(MMToIn, 2)
    };

    public static readonly Unit CubicIN = new()
    {
        Name = "in³",
        DisplayName = "in³",
        Description = "inches cubed",
        DefaultStep = .001F,
        DefaultDecimalPlaces = 5,
        DrawingPostFix = "in³",
        ConversionFactor = 1
    };
    public static readonly Unit CubicMM = new()
    {
        Name = "mm³",
        DisplayName = "mm³",
        Description = "inches cubed",
        DefaultStep = 1,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "mm³",
        ConversionFactor = Pow(MMToIn, 3)
    };


    public static readonly Unit L = new()
    {
        Name = "L",
        DisplayName = "L",
        Description = "Liters",
        DefaultStep = .01F,
        DefaultDecimalPlaces = 4,
        DrawingPostFix = "L",
        ConversionFactor = 1 / 0.01638706F
    };

    public static readonly Unit Gallon = new()
    {
        Name = "gal",
        DisplayName = "gal",
        Description = "Gallons",
        DefaultStep = .01F,
        DefaultDecimalPlaces = 4,
        DrawingPostFix = "gal",
        ConversionFactor = 1 / 0.004329F
    };


    public static readonly Unit ML = new()
    {
        Name = "ml",
        DisplayName = "ml",
        Description = "milliliters",
        DefaultStep = .01F,
        DefaultDecimalPlaces = 4,
        DrawingPostFix = "ml",
        ConversionFactor = 1 / 16.3871F
    };

    public static readonly Unit MG = new()
    {
        Name = "mg",
        DisplayName = "mg",
        Description = "milligrames",
        DefaultStep = 1,
        DefaultDecimalPlaces = 0,
        DrawingPostFix = "mg",
        ConversionFactor = 1
    };
    public static readonly Unit G = new()
    {
        Name = "g",
        DisplayName = "g",
        Description = "grames",
        DefaultStep = .001F,
        DefaultDecimalPlaces = 4,
        DrawingPostFix = "g",
        ConversionFactor = 1000
    };

    public static readonly Unit KG = new()
    {
        Name = "kg",
        DisplayName = "kg",
        Description = "kilogrames",
        DefaultStep = .001F,
        DefaultDecimalPlaces = 4,
        DrawingPostFix = "kg",
        ConversionFactor = 1000000
    };

    public static readonly Unit DEG = new()
    {
        Name = "deg",
        DisplayName = "deg",
        Description = "degrees",
        DefaultStep = 1,
        DefaultDecimalPlaces = 1,
        DrawingPostFix = "˚",
        ConversionFactor = PI / 180
    };
    public static readonly Unit Percent = new()
    {
        Name = "%",
        DisplayName = "%",
        Description = "percent",
        DefaultStep = 1,
        DefaultDecimalPlaces = 0,
        DrawingPostFix = "",
        ConversionFactor = 1
    };



    public static readonly Unit MGPerCubicIN = new()
    {
        Name = "mg/in³",
        DisplayName = "mg/in³",
        Description = "mg per inches cubed",
        DefaultStep = .00001F,
        DefaultDecimalPlaces = 0,
        DrawingPostFix = "mg/in³",
        ConversionFactor = 1
    };
    public static readonly Unit MGPerCubicMM = new()
    {
        Name = "mg/mm³",
        DisplayName = "mg/mm³",
        Description = "mg per inches cubed",
        DefaultStep = .00001F,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "mg/mm³",
        ConversionFactor = 1 / Pow(MMToIn, 3)
    };
    public static readonly Unit MGPerML = new()
    {
        Name = "mg/ml",
        DisplayName = "mg/ml",
        Description = "mg per milligrames",
        DefaultStep = .00001F,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "mg/ml",
        ConversionFactor = 1 * 16.3871F
    };

    public static readonly Unit GPerCubicIN = new()
    {
        Name = "g/in³",
        DisplayName = "g/in³",
        Description = "g per inches cubed",
        DefaultStep = .00001F,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "g/in³",
        ConversionFactor = 1000
    };
    public static readonly Unit GPerCubicMM = new()
    {
        Name = "g/mm³",
        DisplayName = "g/mm³",
        Description = "g per inches cubed",
        DefaultStep = .00001F,
        DefaultDecimalPlaces = 5,
        DrawingPostFix = "g/mm³",
        ConversionFactor = 1000 / Pow(MMToIn, 3)
    };
    public static readonly Unit GPerML = new()
    {
        Name = "g/ml",
        DisplayName = "g/ml",
        Description = "g per milligrames",
        DefaultStep = .00001F,
        DefaultDecimalPlaces = 4,
        DrawingPostFix = "g/ml",
        ConversionFactor = 1000 * 16.3871F
    };

    public static readonly Unit LBS = new()
    {
        Name = "LBS",
        DisplayName = "LBS",
        Description = "Pounds",
        DefaultStep = 5,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "",
        ConversionFactor = 1
    };

    public static readonly Unit Tons = new()
    {
        Name = "tons",
        DisplayName = "tons",
        Description = "Tons",
        DefaultStep = .1F,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "",
        ConversionFactor = 2000
    };
    public static readonly Unit kN = new()
    {
        Name = "kN",
        DisplayName = "kN",
        Description = "kilonewton",
        DefaultStep = .1F,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "",
        ConversionFactor = 1 / 0.00444822F
    };
    public static readonly Unit kP = new()
    {
        Name = "kP",
        DisplayName = "kP",
        Description = "kilopond",
        DefaultStep = 10,
        DefaultDecimalPlaces = 1,
        DrawingPostFix = "",
        ConversionFactor = 2.2046226219F
    };

    public static readonly Unit MPA = new()
    {
        Name = "MPa",
        DisplayName = "MPa",
        Description = "Megapascal",
        DefaultStep = 10,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "",
        ConversionFactor = 145
    };

    public static readonly Unit RPM = new()
    {
        Name = "RPM",
        DisplayName = "RPM",
        Description = "RPM",
        DefaultStep = 1,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "",
        ConversionFactor = 1
    };

    public static readonly Unit Hertz = new()
    {
        Name = "Hz",
        DisplayName = "Hz",
        Description = "Hz",
        DefaultStep = 1,
        DefaultDecimalPlaces = 3,
        DrawingPostFix = "",
        ConversionFactor = 60.0F
    };

    public static readonly Unit TPM = new()
    {
        Name = "TPM",
        DisplayName = "Tablets Per Minute",
        Description = "Tablets Per Minute",
        DefaultStep = 1,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "",
        ConversionFactor = 1
    };

    public static readonly Unit TPH = new()
    {
        Name = "TPH",
        DisplayName = "Tablets Per Hour",
        Description = "Tablets Per Hour",
        DefaultStep = 1,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "",
        ConversionFactor = 1
    };

    public static readonly Unit HR = new()
    {
        Name = "hr",
        DisplayName = "hr",
        Description = "hours",
        DefaultStep = 1,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "",
        ConversionFactor = 1
    };

    public static readonly Unit Tablets = new()
    {
        Name = "Tablets",
        DisplayName = "Tablets",
        Description = "Tablets",
        DefaultStep = 1,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "",
        ConversionFactor = 1,
        ShowUOM = false
    };

    public static readonly Unit ToolStationQty = new()
    {
        Name = "ToolStationQty",
        DisplayName = "Tool Station Qty",
        Description = "Tool Station Qty",
        DefaultStep = 1,
        DefaultDecimalPlaces = 0,
        DrawingPostFix = "",
        ConversionFactor = 1
    };

    public static readonly Unit MainCompressionRollerQty = new()
    {
        Name = "MainCompressionRollerQty",
        DisplayName = "Main Compression Rollers",
        Description = "Main Compression Rollers",
        DefaultStep = 1,
        DefaultDecimalPlaces = 0,
        DrawingPostFix = "",
        ConversionFactor = 1

    };

    public static readonly Unit TipQty = new()
    {
        Name = "TipQty",
        DisplayName = "Tip Qty",
        Description = "Tip Qty",
        DefaultStep = 1,
        DefaultDecimalPlaces = 0,
        DrawingPostFix = "",
        ConversionFactor = 1
    };

    public static readonly Unit ThickToWidthRatio = new()
    {
        Name = "ThickToWidthRatio",
        DisplayName = "Thickness To Width",
        Description = "Thickness To Width",
        DefaultStep = .01F,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "",
        ConversionFactor = 1,
        ShowUOM = false
    };

    public static readonly Unit CornerRadiusToWidth = new()
    {
        Name = "CornerRadiusToWidth",
        DisplayName = "Corner Radius To Width",
        Description = "Corner Radius To Width",
        DefaultStep = .01F,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "",
        ConversionFactor = 1,
        ShowUOM = false
    };

    public static readonly Unit CupToThickRatio = new()
    {
        Name = "CupToThickRatio",
        DisplayName = "Cup To Thickness",
        Description = "Cup To Thickness",
        DefaultStep = .01F,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "",
        ConversionFactor = 1,
        ShowUOM = false
    };

    public static readonly Unit LengthToWidthRatio = new()
    {
        Name = "LengthToWidthRatio",
        DisplayName = "Length To Width",
        Description = "Length To Width",
        DefaultStep = .01F,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "",
        ConversionFactor = 1,
        ShowUOM = false
    };

    public static readonly Unit EndRadiusToWidthRatio = new()
    {
        Name = "EndRadiusToWidthRatio",
        DisplayName = "End Radius To Width",
        Description = "End Radius To Width",
        DefaultStep = .01F,
        DefaultDecimalPlaces = 2,
        DrawingPostFix = "",
        ConversionFactor = 1,
        ShowUOM = false
    };    

    public class Unit
    {
        public string Name { get; set; }
        public string DisplayName { get; set; }
        public string Description { get; set; }

        public float DefaultStep { get; set; }
        public int DefaultDecimalPlaces { get; set; }

        public string DrawingPostFix { get; set; }

        public float ConversionFactor { get; set; }

        public bool ShowUOM { get; set; } = true;


        public float Convert(Unit unitFrom, float value)
        {
            return (unitFrom.ConversionFactor / ConversionFactor) * value;
        }

        public static bool operator ==(Unit c1, Unit c2)
        {
            return c1?.Equals(c2) ?? false;
        }

        public static bool operator !=(Unit c1, Unit c2)
        {
            return !c1?.Equals(c2) ?? true;
        }

        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }

            var objectToCompareWith = (Unit)obj;

            return objectToCompareWith.Name == Name;
        }

        public override int GetHashCode()
        {
            return HashCode.Combine(Name);
        }

    }

}

Static Read-Only Fields never change values

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật