I’m a bit stuck with try to generate a complex if statement like the one below
if (class1.Property == class2.Property || (class3.Property && class4.Property))
{
//do something
}
else
{
//do something else
}
By using the CodeConditionStatement class I can generate the first condition above but I can not seem to find a way to add the second condition especially with the needed brackets and the way if will be evaluated at runtime?
Note: I do not want to use the CodeSnippetExpression class.
Any ideas?
Thanks in advance.
First, a simple way would be to declare a boolean variable.
Initialize it to false and to the sequence of if manipulating that variable.
Don’t worry about performance or readibility, sometime it is more readable.