Answer the question
In order to leave comments, you need to log in
How to track the conditions (OR) under which the entry into the block occurs?
string str = "string";
int num = 3;
ConsoleColor color = ConsoleColor.DarkRed;
if(String.Equals(str, "string2") || num.Equals(3) || color.Equals(ConsoleColor.DarkRed))
{
//TODO
}
Answer the question
In order to leave comments, you need to log in
do this:
cond_num = 0 ;
if (/*condition1*/) {cond_num =1;}
else if (/*condition2*/) {cond_num =2;}
else if (/*condition3*/) {cond_num =3;}
if (cond_num > 0)
{
printf("Condition %d passed/n", cond_num);
//TODO
}
}
And you write a small logging function that returns true and add something like "num.Equals(3) && WriteLog("num.Equals")" to each check. Accordingly, you will find out in the logs due to what condition you failed there. Although performance will drop due to such nonsense.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question