.NET units class, inches to millimeters

前端 未结 7 796
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-04 07:42

Does .NET has Units conversion class? I need to convert inches to millimeters and vise versa.

7条回答
  •  生来不讨喜
    2021-01-04 08:04

    A few Years later there are plenty of Nuget Packages that deal with this. One of them is https://github.com/angularsen/UnitsNet which is able to handle what you want.

    Length distance = Length.FromInch(15);
    distance.Millimeters/ 60;
    

    It also supports a lot of other stuff.

提交回复
热议问题