I have tested it in c since I am on unix console right now. However, logical operators work the same way for c#. following code can also be used to test the equivalance.
#include<stdio.h>
void test(int,int,int,int,int);
void test1(int,int,int,int,int);
int main()
{
for(int i =0 ; i < 2 ; i++)
for(int j =0 ; j < 2 ; j++)
for(int k =0 ; k < 2 ; k++)
for(int l =0 ; l < 2 ; l++)
for(int m =0 ; m < 2 ; m++)
{
printf("A=%d,B=%d,C=%d,D=%d,E=%d",i,j,k,l,m);
test(i,j,k,l,m);
test1(i,j,k,l,m);
printf("\n");
}
return 0;
}
void test1(int A, int B, int C, int D, int E)
{
if( B && (!D || A) && (!E || C))
{
printf("\n\ttrue considering flags");
}
else
{
printf("\n\tfalse considering flags");
}
}
void test(int A, int B, int C, int D, int E)
{
if(D)
{
if( A && B)
if(E)
if(C)
{
printf("\n\ttrue considering flags");
}
else
{
printf("\n\tAB !C DE");
}
}
else
{
if( B)
if(E)
if(C)
{
printf("\n\t!D --ignore A-- BC E");
}
else
{
printf("\n\tfalse considering flags");
}
}
}