Hello All,
I have the below code.
QueryExpression queryexp = new QueryExpression();
queryexp.EntityName = "account";
queryexp.ColumnSet.AddColumn("name");
queryexp.Criteria = new FilterExpression
{
Filters={
new FilterExpression{FilterOperator = LogicalOperator.And, Conditions={new ConditionExpression("name", ConditionOperator.Contains, "a"),
new ConditionExpression("statecode", ConditionOperator.Equal, 0) } },
new FilterExpression{FilterOperator = LogicalOperator.Or, Conditions={new ConditionExpression("name", ConditionOperator.Contains, "b"),
new ConditionExpression("name", ConditionOperator.Contains, "c") } }
}
};
From the definition of FilterExpression class Filters property is a private property without a setter. My question is how is it possible to assign values to Filters property without a setter. My above code gets compiled file without any errors, but i wanted to how is it possible.
If the above code works, then even this should work:
queryexp.Criteria.Filters= {
new FilterExpression{FilterOperator = LogicalOperator.And, Conditions={new ConditionExpression("name", ConditionOperator.Contains, "a"), new ConditionExpression("statecode", ConditionOperator.Equal, 0) } },
new FilterExpression{FilterOperator = LogicalOperator.Or, Conditions={new ConditionExpression("name", ConditionOperator.Contains, "b"),
new ConditionExpression("name", ConditionOperator.Contains, "c") } }
};
PS: This might be more of a C# question, but i still thought to ask in this forum as i felt people here would understand my question better. Also i am new to C#.
*This post is locked for comments