예제 #1
0
        internal static WeightResolution DeserializeWeightResolution(JsonElement element)
        {
            WeightUnit     unit           = default;
            double         value          = default;
            ResolutionKind resolutionKind = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("unit"))
                {
                    unit = new WeightUnit(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("value"))
                {
                    value = property.Value.GetDouble();
                    continue;
                }
                if (property.NameEquals("resolutionKind"))
                {
                    resolutionKind = new ResolutionKind(property.Value.GetString());
                    continue;
                }
            }
            return(new WeightResolution(resolutionKind, unit, value));
        }
 public static WeightResolution WeightResolution(ResolutionKind resolutionKind = default, WeightUnit unit = default, double value = default)
 {
     return(new WeightResolution(resolutionKind, unit, value));
 }