-
Notifications
You must be signed in to change notification settings - Fork 414
Expand file tree
/
Copy pathProgram.cs
More file actions
35 lines (30 loc) · 1.2 KB
/
Copy pathProgram.cs
File metadata and controls
35 lines (30 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Licensed under MIT No Attribution, see LICENSE file at the root.
using UnitsNet;
using UnitsNet.Modular;
using UnitsNet.Modular.Profiles;
using UnitsNet.Units;
namespace AllSiProfileSample;
[UnitsNetModule]
internal interface AllSiUnits : IIncludeProfile<AllSiProfile>
{
}
internal static class Program
{
public static void Main()
{
Length distance = Length.FromKilometers(1.2);
Duration duration = Duration.FromMinutes(1);
Speed speed = distance / duration;
Acceleration acceleration = speed / Duration.FromSeconds(10);
Force force = Mass.FromKilograms(1500) * acceleration;
Pressure pressure = force / (Length.FromMeters(2) * Length.FromMeters(3));
Power power = force * speed;
Energy energy = power * Duration.FromSeconds(30);
Console.WriteLine($"Distance: {distance}");
Console.WriteLine($"Speed: {speed.ToUnit(SpeedUnit.KilometerPerHour)}");
Console.WriteLine($"Force: {force}");
Console.WriteLine($"Pressure: {pressure.ToUnit(PressureUnit.Kilopascal)}");
Console.WriteLine($"Energy: {energy.ToUnit(EnergyUnit.Kilojoule)}");
Console.WriteLine($"Power: {power.ToUnit(PowerUnit.Kilowatt)}");
}
}