Beispiel #1
0
 /// <inheritdoc cref="Energy.FromCalories(UnitsNet.QuantityValue)" />
 public static Energy Calories <T>(this T value) =>
 Energy.FromCalories(Convert.ToDouble(value));
Beispiel #2
0
 /// <inheritdoc cref="Energy.FromCalories(double?)"/>
 public static Energy?Calories(this float?value) => Energy.FromCalories(value);
 /// <inheritdoc cref="Energy.FromCalories(double?)"/>
 public static Energy?Calories(this long?value) => Energy.FromCalories(value);
 /// <inheritdoc cref="Energy.FromCalories(double?)"/>
 public static Energy?Calories(this double?value) => Energy.FromCalories(value);
 /// <inheritdoc cref="Energy.FromCalories(double)"/>
 public static Energy Calories(this int value) => Energy.FromCalories(value);
 /// <inheritdoc cref="Energy.FromCalories(double?)"/>
 public static Energy?Calories(this decimal?value) => Energy.FromCalories(value == null ? (double?)null : Convert.ToDouble(value.Value));
 /// <inheritdoc cref="Energy.FromCalories(double)"/>
 public static Energy Calories(this decimal value) => Energy.FromCalories(Convert.ToDouble(value));
 public static Energy?Calories <T>(this T?value) where T : struct => Energy.FromCalories(value == null ? (double?)null : Convert.ToDouble(value.Value));
 public void NumberToCaloriesTest() =>
 Assert.Equal(Energy.FromCalories(2), 2.Calories());