Yes, there's a big difference: with the #if
directive, the method is not compiled at all; it's just not there in the compiled code. With the Conditional
attribute, the method is compiled, but whether it's called or not depends on the symbols in the client code. If the symbol is not defined in the calling code, the call site is removed, and the method is not called.
This is useful, for instance, for library code that will be called or not based on whether or not the DEBUG symbol is defined. An example is the Debug.Print
method: it will be called only if your project is compiled with the DEBUG symbol, but the method is still there in System.dll whether or not the symbol is defined.