35 lines
807 B
C#
35 lines
807 B
C#
namespace CommonMessurementUnits
|
|
{
|
|
using CommonMessurementUnits.JsonConverters;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
[JsonConverter(typeof(VolumeConverter))]
|
|
public class Volume : Base
|
|
{
|
|
public double Mililiter
|
|
{
|
|
get => this.Liter * MlInL;
|
|
set => this.Liter = value / MlInL;
|
|
}
|
|
|
|
public double Liter
|
|
{
|
|
get => this.value * LInm3;
|
|
set => this.value = value / LInm3;
|
|
}
|
|
|
|
public double CubicMeter
|
|
{
|
|
get => this.value;
|
|
set => this.value = value;
|
|
}
|
|
|
|
public static implicit operator Volume(double x)
|
|
=> new Volume { value = x };
|
|
|
|
public static implicit operator Volume(double? x)
|
|
=> new Volume { value = x ?? 0 };
|
|
}
|
|
}
|