PhysicalMeasure.NET 計(jì)量單位組件
PhysicalMeasure 是一個 C# 庫,根據(jù)特定值和單位來處理物理計(jì)量單位,支持多個單位系統(tǒng)的轉(zhuǎn)換。
PhysicalMeasure 要求 .NET framework 4.0.
PhysicalMeasure 可以用來展示和處理物理度量,或者計(jì)算物理屬性。
示例
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);
}
評論
圖片
表情
