On Tue, Jun 4, 2013 at 4:44 PM, Fredericks, Chris
<[email protected]>wrote:

>  Microsoft has left some room for ReSharper.  :P****
>
> ** **
>
> Without braces:    error - ‘Invalid embedded statement’****
>
> With braces:    warning - ‘Local variable ‘foo’ is never used’****
>
> **
>

And then there's variable hiding, which some analysis tools pick up.

"outer foo is hidden by inner foo"


>  **
>
> Cheers,****
>
> Chris****
>
> ** **
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *David Burstin
> *Sent:* Tuesday, 4 June 2013 4:06 PM
> *To:* ozDotNet
> *Subject:* Re: If-else vs switch - declaring inner variables (a
> philosophical question)****
>
> ** **
>
> ** **
>
> On 4 June 2013 15:43, Piers Williams <[email protected]> wrote:****
>
> You've basically asked about C#'s scoping rules.  Eric Lippert has
> answered this question a few times, here he is talking about it on
> StackOverflow:****
>
> http://stackoverflow.com/a/2050864****
>
>
> Thanks for the link - some interesting reading there.****
>
> ** **
>
> Do you have any info for the later question - "Why can't a useless
> variable be declared after an if without braces, but is ok if we wrap that
> single line in a pair of curlies?". I haven't been able to find anything.*
> ***
>
> ** **
>
> Cheers****
>
> DB****
>



-- 
Meski

 http://courteous.ly/aAOZcv

"Going to Starbucks for coffee is like going to prison for sex. Sure,
you'll get it, but it's going to be rough" - Adam Hills

Reply via email to