public static R CreateTraceSourceScope <R>(int operation, Func <TraceSourceScope, R> func) { using (var scope = new TraceSourceScope(operation)) { return(func(scope)); } }
public void UsingStatement() { using (var s1 = new TraceSourceScope(1)) using (var s2 = new TraceSourceScope(10)) using (var s3 = new TraceSourceScope(100)) { Trace.WriteLine(s1.Operation + s2.Operation + s3.Operation); } }