Conditional Attribute : Attribute « Development « C# / CSharp Tutorial






using System;
using System.Diagnostics;

class Program {
    static void Main(string[] args) {
        Program.DebugOnly();
    }

    [Conditional("DEBUG")]
    public static void DebugOnly() {
        Console.WriteLine("This string only displays in Debug");
    }
}








14.37.Attribute
14.37.1.Conditional Attribute