When #if DEBUG runs

#if DEBUG It’s a preprocessor definition.

It compiles when you define DEBUG constant. And yes, it’s default on Debug Build Configuration.

Visual Studio 2010 Project Properties:
Visual Studio 2010 Project Properties

If Define DEBUG constant is checked VS will compile:

private const string BASE_URL = "http://www.a.com/";

Else (not checked) VS will compile:

private const string BASE_URL = "http://www.b.com//";

Leave a Comment