Handling Assignment and Equivalence operators in C#

The programmers still forget some logical level implementations of 'Assignment and Equivalence'.
C# understands the users and acts in a smart way always saying ' I am a wonderful language of operator intelligence.. '

An extremely common error in C and C++ looks like this:
while(x = y) {
// ....

The programmer was trying to test for equivalence (==) rather than do an assignment.
In C and C++ the result of this assignment will always be true if y is nonzero, and you’ll probably get an infinite loop.

Now... With the power of C# ...!!!

In C#, the result of this expression is not a bool, and the compiler expects a bool and won’t convert from an int,
so it will conveniently give you a compile-time error and catch the problem before you ever try to run the program.
So the pitfall never happens in C#.

A similar problem in C and C++ is using bitwise AND and OR instead of the logical versions.
Bitwise AND and OR use one of the characters (& or |) while logical AND and OR use two (&& and ||).
Just as with = and ==, it’s easy to type just one character instead of two.

In C#, the compiler again prevents this because it won’t let you cavalierly use one type where it doesn’t belong.

Appreciating C# ?