示例#1
0
        Profile IOperationSource <Profile> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = ProfileData.DeserializeProfileData(document.RootElement);

            return(new Profile(_armClient, data));
        }
示例#2
0
        internal static ProfileListResult DeserializeProfileListResult(JsonElement element)
        {
            Optional <IReadOnlyList <ProfileData> > 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 <ProfileData> array = new List <ProfileData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ProfileData.DeserializeProfileData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new ProfileListResult(Optional.ToList(value), nextLink.Value));
        }