Exemplo n.º 1
0
        internal static InterpolationOperation DeserializeInterpolationOperation(JsonElement element)
        {
            Optional <InterpolationKind>     kind     = default;
            Optional <InterpolationBoundary> boundary = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    kind = new InterpolationKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("boundary"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    boundary = InterpolationBoundary.DeserializeInterpolationBoundary(property.Value);
                    continue;
                }
            }
            return(new InterpolationOperation(Optional.ToNullable(kind), boundary.Value));
        }
 internal InterpolationOperation(InterpolationKind?kind, InterpolationBoundary boundary)
 {
     Kind     = kind;
     Boundary = boundary;
 }