|
If we want a code block to run in only debug mode, we can use one of these 2 ways:
private void Form1_Load(object sender, EventArgs e) {
#if DEBUG MessageBox.Show("debug"); #else MessageBox.Show("not debug"); #endif RunInDebug(); }
[Conditional("DEBUG")] static void RunInDebug() { MessageBox.Show("Debug mode"); }
|