tags:

views:

500

answers:

3

Looking at the C# and VB.NET language specs I think it says that the logical Xor/Or/And operations have different precendence in the two languages. Am I reading that right? I was expecting them to have the same precendence.

For example in C#

100 | 200 ^ 300 & 400

is the same as...

100 | (200 ^ (300 & 400))

But the equivalent VB.NET

100 Or 200 Xor 300 And 400

as far as I can tell is the same as...

(100 Or 200) Xor (300 And 400)

Am I reading that right?

+4  A: 

Am I reading that right?

Yes. Simple as that.

Konrad Rudolph
+4  A: 

Personally, I'm not a fan of remembering precedence rules. If there is any ambiguity, I just add brackets. Even if I get it right, somebody else might have to read it, and I don't know which background they'll have...

But I think you are reading it correctly.

Marc Gravell
A: 

It's worst to remember precedence.