#if
is know as a preprocessor directive. Your code means: if b.Trace is true, Compile the
Trace
line
compiled, othewise don't. For example if your code had been:
if bTrace Then
Trace.WriteLine("Begun db query at " & now())
End If
Then the above code will always be compiled, and the if condition evaluated. This causes a loss of performance.
Often
#if
is used to add code you only want to execute under a debug build, without a performance hit when live code is compiled. I avoid preprocessor directives, the performance gain isn't
normally enough to justify the WTF factor and messy code, but I do use them on occaision.
See
#if C# Rerence MSDN