Or should we use another practice to execute certain code if we re in debug while we execute another code while we are in release. what is a good practice to do that pls.
Thanks
Or should we use another practice to execute certain code if we re in debug while we execute another code while we are in release. what is a good practice to do that pls.
Thanks
does it make sense to use #If Debug Then and #If LIVE Then
Daikoku
just in code. how can we know if we in debug or in release mode so that in case we are in release mode, we perform certain tasks that we don t want to do in debug mode.
Thanks
KTI
Cammyr
The ConditionalAttribute was added in .NET to avoid having to use the preprocessor to filter out debug code during release builds. Generally, it's suggested that ConditionalAttribute be used on a method definition in order for the method to be "empty" during release builds. For example:
[System.Diagnostics.Conditional("DEBUG")]
void DebugOnly()
{
// do something knowing it will only be performed in debug mode.
}
The benefit to this is no #if DEBUG...#endif need be added to calls to DebugOnly()...
Aiwa
Perfect. That answers my question.
How about if we want to include several methods in debug only. that means we should include as many
[System.Diagnostics.Conditional("DEBUG")] as methods or can we use a single
[System.Diagnostics.Conditional("DEBUG")] with multiple methods and close it at the end. is that possible.
Thanks a lot
Qaayam