Does C# compile code inside an if(false) block?

Posted by aximili on Stack Overflow See other posts from Stack Overflow or by aximili
Published on 2010-05-06T07:18:23Z Indexed on 2010/05/06 7:28 UTC
Read the original article Hit count: 251

Filed under:
|

I am just wondering if these code blocks gets compiled into .dll

I don't think this one gets compiled at all

#if SOMETHING_UNDEFINED
// some code - this is ignored by the compiler
#endif

Now what about these?

1.

if(false) {
  // some code - is this compiled?
}

2.

const bool F = false;
if(F) {
  // some code - is this compiled?
}

3.

bool F = false;
if(F) {
  // some code - is this compiled?
}

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#