Optional compiling is useful to include additional testing or diagnostics.
In the top of the file or in the project settings create a define and use the Conditional attribute for the function / method
#define MY_DEFINE
[Conditional(“MY_DEFINEā)]
void function()
{
}