TraceWriteLineIf : TraceSwitch « Development « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;


public class MainClass
{
    public static void Main()
    {
        TraceSwitch testTraceSwitch = new TraceSwitch("testTraceSwitch", "info");
        Trace.WriteLineIf(testTraceSwitch.TraceError, "Something bad happened");
        Trace.WriteLineIf(testTraceSwitch.TraceInfo, "Some informational trace");
    }
}








14.30.TraceSwitch
14.30.1.TraceWriteLineIf
14.30.2.User-Defined Switch