Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 VS2010 单元测试框架。除了测试我的代码之外,我还在做一些计时事情。但是,这意味着当我使用调试模式单步执行测试代码时,时序会出现偏差。如果测试是使用“运行”或“调试”运行的,我可以在代码中检测到吗?
我相信 Debugger.IsAttached会得到你所需要的
Debugger.IsAttached