Define contant and use it in Conditional attribute

image_pdfimage_print
   
 

#define LOG

using System;
using System.IO;
using System.Diagnostics;


class Starter {
    static void Main() {
        LogInfo(new StreamWriter(@"c:logfile.txt"));
    }

    [Conditional("LOG")]
    private static void LogInfo(StreamWriter sr) {
        // write information to log file
    }
}