For this purpose, you can use the Conditional attribute in methods (but not in separate lines of code).
For example, the following will be compiled only in DEBUG assemblies.
[Conditional("DEBUG")]
public void MyMethod()
{
}
The DEBUG symbol is already specified in the project settings. You must create your own symbol to build the release, say "RELEASE" so you can do this:
[Conditional("RELEASE")]
public void MyMethod()
{
}
However, I would recommend stepping back and looking at your problem again from a higher level, since I would not highly recommend this solution.