-
Notifications
You must be signed in to change notification settings - Fork 414
Expand file tree
/
Copy pathProgram.cs
More file actions
28 lines (22 loc) · 758 Bytes
/
Copy pathProgram.cs
File metadata and controls
28 lines (22 loc) · 758 Bytes
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
// Licensed under MIT No Attribution, see LICENSE file at the root.
using UnitsNet.Modular;
namespace Fictional.Measurements;
[QuantitySpec("Fictional.Measurements.HowMuch")]
public interface HowMuchSpec
{
}
[UnitsNetModule]
internal interface FictionalUnits : IInclude<HowMuchSpec>
{
}
internal static class Program
{
public static void Main()
{
HowMuch amount = HowMuch.Parse("10 tons");
HowMuch magnitude = HowMuch.FromMagnitudes(3);
Console.WriteLine($"{amount} = {amount.ToUnit(HowMuchUnit.Lots)} = {amount.ToUnit(HowMuchUnit.Some)}");
Console.WriteLine($"{magnitude} = {magnitude.ToUnit(HowMuchUnit.Some)}");
Console.WriteLine($"Generated in custom namespace: {typeof(HowMuch).FullName}");
}
}