Does C# allow short-circuit evaluation of Boolean expressions? That is, if you have an expression such as
if (test1) & (test2) {....}
when test1 is false, there is no reason to evaluate test2 and a language which supports short-circuit evaluation never looks at the second test because the result will obviously be false. From what I can tell, C# doesn't do that, at least by default. Is there a compiler directive or attribute which will allow that?
fishsqzr
0
Junior Poster in Training
Recommended Answers
Jump to PostYes
Jump to PostFrom what I can tell, C# doesn't do that, at least by default. Is there a compiler directive or attribute which will allow that?
So basically you think c# doesn't support short-circuit evaluation ?
Have a look here: http://msdn2.microsoft.com/en-us/library/2a723cdk(VS.71).aspx@iamthwee: Those kind of answers are not …
All 8 Replies
iamthwee
scru
commented:
Wasn't as stupid as it was funny, lol
+1
_r0ckbaer
0
Light Poster
jquick
0
Newbie Poster
fishsqzr
0
Junior Poster in Training
_r0ckbaer
0
Light Poster
_r0ckbaer
0
Light Poster
fishsqzr
0
Junior Poster in Training
iamthwee
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.