Esempio n. 1
0
        internal static ListSkillsetsResult DeserializeListSkillsetsResult(JsonElement element)
        {
            IReadOnlyList <Skillset> value = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    List <Skillset> array = new List <Skillset>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(Skillset.DeserializeSkillset(item));
                        }
                    }
                    value = array;
                    continue;
                }
            }
            return(new ListSkillsetsResult(value));
        }
        internal static ListSkillsetsResult DeserializeListSkillsetsResult(JsonElement element)
        {
            ListSkillsetsResult result = new ListSkillsetsResult();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        result.Skillsets.Add(Skillset.DeserializeSkillset(item));
                    }
                    continue;
                }
            }
            return(result);
        }
Esempio n. 3
0
        internal static Skillset DeserializeSkillset(JsonElement element)
        {
            Skillset result = new Skillset();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    result.Name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    result.Description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("skills"))
                {
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        result.Skills.Add(Skill.DeserializeSkill(item));
                    }
                    continue;
                }
                if (property.NameEquals("cognitiveServices"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.CognitiveServicesAccount = CognitiveServicesAccount.DeserializeCognitiveServicesAccount(property.Value);
                    continue;
                }
                if (property.NameEquals("@odata.etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result.ETag = property.Value.GetString();
                    continue;
                }
            }
            return(result);
        }