/// <summary> /// Reads the JSON representation of the object. /// </summary> /// <param name="reader">The JsonReader to read from.</param> /// <param name="objectType">Type of the object.</param> /// <param name="existingValue">The existing value of object being read.</param> /// <param name="serializer">The calling serializer.</param> public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.ValueType == typeof(string)) { if (objectType == typeof(EnergyMassDensity)) { return(EnergyMassDensity.Parse((string)reader.Value)); } } throw new NotImplementedException(); }
public SpecificHeatCapacity ConvertTo(SpecificHeatCapacityUnit newUnit) { // generator : FractionValuesGenerator.Add_ConvertTo if (Unit.Equals(newUnit)) { return(this); } var a = new EnergyMassDensity(Value, Unit.CounterUnit); var b = new KelvinTemperature(1, Unit.DenominatorUnit); a = a.ConvertTo(newUnit.CounterUnit); b = b.ConvertTo(newUnit.DenominatorUnit); return(new SpecificHeatCapacity(a.Value / b.Value, newUnit)); }
public bool Equals(EnergyMassDensity other) { return(Value == other.Value && !(Unit is null) && Unit.Equals(other.Unit)); }