[Conditional("DEBUG")]
void Foo() {
}
The advantage here is that the code is not reachable anymore if the condition is not met. This means that it will result in compile errors if you reference this method. #if … #endif does not enforce this constraint.