Skip to content

Instantly share code, notes, and snippets.

@luisdeol
Created April 24, 2020 16:36
Show Gist options
  • Save luisdeol/bfad21b4068b8e46a7dd0ed61c1fc105 to your computer and use it in GitHub Desktop.
Save luisdeol/bfad21b4068b8e46a7dd0ed61c1fc105 to your computer and use it in GitHub Desktop.
3.4: Preprocessor directives
#define CUSTOM_DIR
// #undef CUSTOM_DIR
// undef removes the preprocessor directive definition. Uncomment the code above and notice how the display message changes.
using System;
namespace _34_DebugAnApplication
{
class Program
{
static void Main(string[] args)
{
#if DEBUG
Console.WriteLine("Debug mode.");
#else
Console.WriteLine("Release mode.");
#endif
#if CUSTOM_DIR
Console.WriteLine("CUSTOM_DIR defined");
#else
Console.WriteLine("CUSTOM_DIR NOT DEFINED");
#endif
#region REGION 1
Console.WriteLine("Region 1");
#endregion
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment