Exemple #1
0
        internal static LegalHoldProperties DeserializeLegalHoldProperties(JsonElement element)
        {
            Optional <bool> hasLegalHold = default;
            Optional <IReadOnlyList <TagProperty> > tags = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("hasLegalHold"))
                {
                    hasLegalHold = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    List <TagProperty> array = new List <TagProperty>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TagProperty.DeserializeTagProperty(item));
                    }
                    tags = array;
                    continue;
                }
            }
            return(new LegalHoldProperties(Optional.ToNullable(hasLegalHold), Optional.ToList(tags)));
        }
Exemple #2
0
        internal static LegalHoldProperties DeserializeLegalHoldProperties(JsonElement element)
        {
            bool?hasLegalHold        = default;
            IList <TagProperty> tags = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("hasLegalHold"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    hasLegalHold = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <TagProperty> array = new List <TagProperty>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(TagProperty.DeserializeTagProperty(item));
                        }
                    }
                    tags = array;
                    continue;
                }
            }
            return(new LegalHoldProperties(hasLegalHold, tags));
        }