コード例 #1
0
 public void ConvertInline(List <TValue> values)
 {
     if (null == TemperatureConverter && null == SpeedConverter && null == PressureConverter)
     {
         return;
     }
     if (typeof(TValue).IsSubclassOf(typeof(ReadingValues)))
     {
         for (var i = 0; i < values.Count; i++)
         {
             var target = values[i] as ReadingValues;
             if (null != TemperatureConverter)
             {
                 target.Temperature = TemperatureConverter.Conversion(target.Temperature);
             }
             if (null != PressureConverter)
             {
                 target.Pressure = PressureConverter.Conversion(target.Pressure);
             }
             if (null != SpeedConverter)
             {
                 target.WindSpeed = SpeedConverter.Conversion(target.WindSpeed);
             }
         }
         return;
     }
     for (var i = 0; i < values.Count; i++)
     {
         values[i] = Conversion(values[i]);
     }
 }
コード例 #2
0
 public void ConvertInline(ref TValue value)
 {
     if (null == TemperatureConverter && null == SpeedConverter && null == PressureConverter)
     {
         return;
     }
     if (value is ReadingValues)
     {
         var target = value as ReadingValues;
         if (null != TemperatureConverter)
         {
             target.Temperature = TemperatureConverter.Conversion(target.Temperature);
         }
         if (null != PressureConverter)
         {
             target.Pressure = PressureConverter.Conversion(target.Pressure);
         }
         if (null != SpeedConverter)
         {
             target.WindSpeed = SpeedConverter.Conversion(target.WindSpeed);
         }
         return;
     }
     value = Conversion(value);
 }
コード例 #3
0
 public ReadingValuesConverter(
     TemperatureConverter temperatureConverter,
     SpeedConverter speedConverter,
     PressureConverter pressureConverter
     ) : base(temperatureConverter, speedConverter, pressureConverter)
 {
 }