コード例 #1
0
        private void ConvertFromPint(WetMeasurement destination)
        {
            if (destination == WetMeasurement.Pint)
            {
                return;
            }
            switch (destination)
            {
            case WetMeasurement.Gallon:
                Quantity = Quantity / 8;
                break;

            case WetMeasurement.Quart:
                Quantity = Quantity / 2;
                break;

            case WetMeasurement.Cup:
                Quantity = Quantity * 2;
                break;

            case WetMeasurement.Ounce:
                Quantity = Quantity * 16;
                break;
            }
            Measurement = destination;
        }
コード例 #2
0
        public void Convert(WetMeasurement destination)
        {
            switch (destination)
            {
            case WetMeasurement.Gallon:
                ConvertFromGallon(destination);
                break;

            case WetMeasurement.Quart:
                ConvertFromQuart(destination);
                break;

            case WetMeasurement.Pint:
                ConvertFromPint(destination);
                break;

            case WetMeasurement.Cup:
                ConvertFromCup(destination);
                break;

            case WetMeasurement.Ounce:
                ConvertFromOunce(destination);
                break;
            }
        }