PhysicalMeasure是一个C#库,根据特定值和单位来处理物理计量单位,支持多个单位系统的转换。PhysicalMeasure要求.NETframework4.0.PhysicalMeasure可以用来展示和处理物理度量,或者计算物理属性。示例
using PhysicalMeasure;public void CalculateEnergyIn1Gram(){ PhysicalQuantity m = new PhysicalQuantity(0.001, SI.kg); PhysicalQuantity c = new PhysicalQuantity(299792458, SI.m / SI.s); PhysicalQuantity E = m * c.Pow(2); PhysicalQuantity expected = new PhysicalQuantity(0.001 * 299792458 * 299792458, SI.J); Assert.AreEqual(expected, E);}点击空白处退出提示
评论