示例#1
0
        internal static DescendantInfo DeserializeDescendantInfo(JsonElement element)
        {
            Optional <string> id          = default;
            Optional <string> type        = default;
            Optional <string> name        = default;
            Optional <string> displayName = default;
            Optional <DescendantParentGroupInfo> parent = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        id = null;
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        type = null;
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("displayName"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                displayName = null;
                                continue;
                            }
                            displayName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("parent"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                parent = null;
                                continue;
                            }
                            parent = DescendantParentGroupInfo.DeserializeDescendantParentGroupInfo(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new DescendantInfo(id.Value, type.Value, name.Value, displayName.Value, parent.Value));
        }
        internal static DescendantInfo DeserializeDescendantInfo(JsonElement element)
        {
            ResourceIdentifier id          = default;
            string             name        = default;
            ResourceType       type        = default;
            SystemData         systemData  = default;
            Optional <string>  displayName = default;
            Optional <DescendantParentGroupInfo> parent = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("displayName"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                displayName = null;
                                continue;
                            }
                            displayName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("parent"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                parent = null;
                                continue;
                            }
                            parent = DescendantParentGroupInfo.DeserializeDescendantParentGroupInfo(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new DescendantInfo(id, name, type, systemData, displayName.Value, parent.Value));
        }