Tag Info

New answers tagged

4

It is a subjective issue. On every new project we (myself and some colleagues I know) start, we set warnings to compile errors by default. We end up with a clean code base, easy solution. (Plus, we also enable FxCop, StyleCop issues as errors, very low cost if you do it from the beginning). Every warning has some impact on quality, maintainability, ...


1

There might be some reasons to evaluate both statements when dealing with sideeffects: if you want both to happen! The best example I can come up right now is logging: you have two checks (both have to be true) and want to log both checks and their results (as a sideffect in the check) - in this case VB's AND is a good idea.


3

C# doesn't have "And" and "Or". It has "&&" and "||". "AndAlso" and "OrElse" were added to Visual Basic to provide a [new] syntax for "short-circuiting" the evaluation of conditions (which C# has always done, but Basic didn't). There was a lot of "discussion" early on about whether the existing operators should be reworked to support this but, ...


-1

After allowing this question to live online for a while, and also working with peers on research and usage regarding Casting and Converting, the answer has become clear. The question was: Is there any time CType() is the proper option over other methods? The answer is: No. From this point on, never use CType(). The only argument is: "What if you don't ...



Top 50 recent answers are included