我如何测试代码在 Debug模式下执行。
这是我想用伪代码做的事情
if not debugMode then
Do something()
end if
最佳答案
您可以使用 Debugger.IsAttached判断程序是否正在调试。
If Not Debugger.IsAttached Then
DoSomething()
End If
编辑如果你总是想跳过
DoSomething
调试版本中的代码,无论是否使用调试器,都使用 conditional compilation与 #If ,像这样#IF DEBUG Then
DoSomething()
#End If
关于vb.net - 测试代码是否在 Debug模式下执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1265581/