Hi,
In an old version of c i had to use something like this: if (x==y). I am wondering if I can now use if (x=y) or do I still need the ==?
Jeremy
Printable View
Hi,
In an old version of c i had to use something like this: if (x==y). I am wondering if I can now use if (x=y) or do I still need the ==?
Jeremy
Nope, == is an overloaded operator that implicity performs either a reference equality or value equality comparison, dependent upon the type being used.
Also since C# is strongly type, if (x=y) this would never compile, because you are performing and assignment and it would always be true. In C or C++ this would be hard to catch, leading to some frustrating debugging sessions. :D