public IsDeviceMatchConditionParameters(IsDeviceMatchConditionParametersOdataType odataType, IsDeviceOperator @operator)
 {
     OdataType   = odataType;
     Operator    = @operator;
     MatchValues = new ChangeTrackingList <IsDeviceMatchConditionParametersMatchValuesItem>();
     Transforms  = new ChangeTrackingList <TransformCategory>();
 }
 internal IsDeviceMatchConditionParameters(IsDeviceMatchConditionParametersOdataType odataType, IsDeviceOperator @operator, bool?negateCondition, IList <IsDeviceMatchConditionParametersMatchValuesItem> matchValues, IList <TransformCategory> transforms)
 {
     OdataType       = odataType;
     Operator        = @operator;
     NegateCondition = negateCondition;
     MatchValues     = matchValues;
     Transforms      = transforms;
 }
Пример #3
0
        internal static IsDeviceMatchConditionParameters DeserializeIsDeviceMatchConditionParameters(JsonElement element)
        {
            IsDeviceMatchConditionParametersOdataType odataType = default;
            IsDeviceOperator @operator       = default;
            Optional <bool>  negateCondition = default;
            Optional <IList <IsDeviceMatchConditionParametersMatchValuesItem> > matchValues = default;
            Optional <IList <TransformCategory> > transforms = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("@odata.type"))
                {
                    odataType = new IsDeviceMatchConditionParametersOdataType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("operator"))
                {
                    @operator = new IsDeviceOperator(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("negateCondition"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    negateCondition = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("matchValues"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <IsDeviceMatchConditionParametersMatchValuesItem> array = new List <IsDeviceMatchConditionParametersMatchValuesItem>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(new IsDeviceMatchConditionParametersMatchValuesItem(item.GetString()));
                    }
                    matchValues = array;
                    continue;
                }
                if (property.NameEquals("transforms"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <TransformCategory> array = new List <TransformCategory>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(new TransformCategory(item.GetString()));
                    }
                    transforms = array;
                    continue;
                }
            }
            return(new IsDeviceMatchConditionParameters(odataType, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)));
        }