示例#1
0
        internal static ListHubRouteTablesResult DeserializeListHubRouteTablesResult(JsonElement element)
        {
            Optional <IReadOnlyList <HubRouteTable> > value = default;
            Optional <string> nextLink = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <HubRouteTable> array = new List <HubRouteTable>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(HubRouteTable.DeserializeHubRouteTable(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new ListHubRouteTablesResult(Optional.ToList(value), nextLink.Value));
        }
        internal static ListHubRouteTablesResult DeserializeListHubRouteTablesResult(JsonElement element)
        {
            IReadOnlyList <HubRouteTable> value = default;
            string nextLink = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <HubRouteTable> array = new List <HubRouteTable>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(HubRouteTable.DeserializeHubRouteTable(item));
                        }
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new ListHubRouteTablesResult(value, nextLink));
        }