Esempio n. 1
0
 private Volume GetInstanceOfCurrentVolume()
 {
     Volume volume;
     switch (Unit)
     {
         case VolumeUnit.Gallons:
             {
                 volume = new USGallon(Value);
                 break;
             }
         case VolumeUnit.Litres:
             {
                 volume = new Litre(Value);
                 break;
             }
         case VolumeUnit.Quarts:
             {
                 volume = new USQuart(Value);
                 break;
             }
         default:
             {
                 throw new Exception(String.Format("Volume unit {0} is unknown.", Unit.GetType().Name));
             }
     }
     return volume;
 }
Esempio n. 2
0
        private Volume GetInstanceOfCurrentVolume()
        {
            Volume volume;

            switch (Unit)
            {
            case VolumeUnit.Gallons:
            {
                volume = new USGallon(Value);
                break;
            }

            case VolumeUnit.Litres:
            {
                volume = new Litre(Value);
                break;
            }

            case VolumeUnit.Quarts:
            {
                volume = new USQuart(Value);
                break;
            }

            default:
            {
                throw new Exception(String.Format("Volume unit {0} is unknown.", Unit.GetType().Name));
            }
            }
            return(volume);
        }