Quantcast
Channel: Or versus OrElse - Stack Overflow
Browsing all 9 articles
Browse latest View live

Answer by TomXP411 for Or versus OrElse

The reason the compilation fails in the example is the order of operations.The expression parser is trying to evaluate "dbnull.value or temp" first. if temp is (dbnull.value or temp) = 0The error is...

View Article



Answer by KnowKnot for Or versus OrElse

Unless your code logic requires the short-circuiting behavior OrElse provides, I would lean toward using the Or operator because:Using "Or" is simple and requires less typing.The computational time...

View Article

Answer by Larz for Or versus OrElse

OrElse evaluate first expression then if its true it will proceed to the statement while OR evaluates two expressions before it will proceed to their statement.Example:Textbox1.Text= 4Textbox2.Text=...

View Article

Answer by FrankX for Or versus OrElse

The Bert' s answer is not very accurate. The '|' or '&' is logical operator, in C #, it always treat as bit operator, please see the following code as example static void Main() { object a = null;...

View Article

Answer by Bert Heesbeen for Or versus OrElse

This is the same behaviour as with C#, where everyone uses the Coditional Or (||) and the Conditional And (&&), where you also have the normal Or (|) and normal And (&). So comparing C# to...

View Article


Answer by AakashM for Or versus OrElse

OrElse is a short-circuiting operator, Or is not.By the definition of the boolean 'or' operator, if the first term is True then the whole is definitely true - so we don't need to evaluate the second...

View Article

Answer by stevehipwell for Or versus OrElse

OrElse is short circuited, this means that only one side of the expression will be tested if the first side is a match.Just like AndAlso will only test one side of the expression if the first half is a...

View Article

Answer by Utaal for Or versus OrElse

(I've looked at other answers and realized I was terribly wrong)The OrElse operator "performs short-circuiting logical disjunction on two expressions", that is to say: if the left operand is true and...

View Article


Or versus OrElse

What's the difference between or and OrElse?if temp is dbnull.value or temp = 0produces the error:Operator '=' is not defined for type 'DBNull' and type 'Integer'.while this one works like a charm!?if...

View Article

Browsing all 9 articles
Browse latest View live




Latest Images