コード例 #1
0
        internal static AgeResolution DeserializeAgeResolution(JsonElement element)
        {
            AgeUnit        unit           = default;
            double         value          = default;
            ResolutionKind resolutionKind = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("unit"))
                {
                    unit = new AgeUnit(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 AgeResolution(resolutionKind, unit, value));
        }
コード例 #2
0
 public static AgeResolution AgeResolution(ResolutionKind resolutionKind = default, AgeUnit unit = default, double value = default)
 {
     return(new AgeResolution(resolutionKind, unit, value));
 }