The Conditional attribute setting in Compile parameter
// csc /define:DEBUG MainClass.cs
using System;
using System.Diagnostics;
public class MyClass {
[Conditional("DEBUG")]
public void OnlyWhenDebugIsDefined( ) {
Console.WriteLine("DEBUG is defined");
}
}
public class MainClass {
public static void Main( ) {
MyClass f = new MyClass( );
f.OnlyWhenDebugIsDefined( );
}
}