if (System.Diagnostics.Debugger.IsAttached)
{
}
else
{
}
or
#If DEBUG Then
Console.WriteLine("Debug mode.")
#Else
Console.WriteLine("Release mode.")
#End If
Make sure that the option "Configuration settings" -> "Build" "Define DEBUG constant" in the project properties is checked.
or
#If CONFIG = "Debug" Then
'do somtehing
#Else
'do something else
#EndIf