internal static NumberResolution DeserializeNumberResolution(JsonElement element)
        {
            NumberKind     numberKind     = default;
            string         value          = default;
            ResolutionKind resolutionKind = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("numberKind"))
                {
                    numberKind = new NumberKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("value"))
                {
                    value = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("resolutionKind"))
                {
                    resolutionKind = new ResolutionKind(property.Value.GetString());
                    continue;
                }
            }
            return(new NumberResolution(resolutionKind, numberKind, value));
        }
示例#2
0
        internal NumberResolution(NumberKind numberKind, string value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            NumberKind     = numberKind;
            Value          = value;
            ResolutionKind = ResolutionKind.Number;
        }
示例#3
0
 internal NumberResolution(ResolutionKind resolutionKind, NumberKind numberKind, string value) : base(resolutionKind)
 {
     NumberKind     = numberKind;
     Value          = value;
     ResolutionKind = resolutionKind;
 }
 public static NumberResolution NumberResolution(ResolutionKind resolutionKind = default, NumberKind numberKind = default, string value = null)
 {
     return(new NumberResolution(resolutionKind, numberKind, value));
 }