Hi Lloyd,
I disagree about what the OP wanted, but even if the OP did want to know how
reflection could be used to discover debug symbols then the answer would
certainly not be to look for the ConditionalAttribute.
"[ConditionalAttribute i]ndicates to compilers that a method call or
attribute should be ignored unless a specified conditional compilation
symbol is defined."
ConditionalAttribute Class
http://msdn2.microsoft.com/en-us/library/system.diagnostics.conditionalattribute.aspx
The ConditionalAttribute isn't placed on your methods by Visual Studio or
the C# compiler. You must add it yourself. It's used by classes in the
System.Diagnostics namespace such as Debug and Trace, for example, so that
calls will be omitted depending on the build configuration.
My suggestion works since a call to a method with the ConditionalAttribute
is omitted when the calling assembly does not have the DEBUG symbol defined.
It does not require recompilation of the calling assembly or the assembly in
which the method is defined. If that was true then the System.Diagnostics
classes wouldn't work either.
As I understood it, this is what the OP wanted to know how to accomplish.
To be perfectly honest, I don't think it's even possible to examine debug
symbols using reflection.