示例#1
0
        public Volume Convert(VolumeUnit volumeUnit)
        {
            var width  = volumeUnit.BaseUnit.Convert(Width);
            var height = volumeUnit.BaseUnit.Convert(Height);
            var depth  = volumeUnit.BaseUnit.Convert(Depth);

            return(new Volume(width.Value, height.Value, depth.Value, volumeUnit));
        }
示例#2
0
        public double Calculate(VolumeUnit volumeUnit)
        {
            var volume = volumeUnit.Convert(this);

            return(volume.Width.Value * volume.Height.Value * volume.Depth.Value);
        }
示例#3
0
 public Volume(double width, double height, double depth, VolumeUnit volumeUnit)
 {
     Width  = new Length(width, volumeUnit.BaseUnit);
     Height = new Length(height, volumeUnit.BaseUnit);
     Depth  = new Length(depth, volumeUnit.BaseUnit);
 }