如何仅在ASP.NET中的调试模式下执行代码 [英] How to execute code only in debug mode in ASP.NET
本文介绍了如何仅在ASP.NET中的调试模式下执行代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
#if DEBUG
你的代码
#endif
您还可以添加 ConditionalAttribute 只有当您以调试模式构建时才执行该方法:
[条件(DEBUG)]
void SomeMethod()
{
}
I have an ASP.NET web application and I have some code that I want to execute only in the debug version. How to do this?
解决方案
#if DEBUG
your code
#endif
You could also add ConditionalAttribute to method that is to be executed only when you build it in debug mode:
[Conditional("DEBUG")]
void SomeMethod()
{
}
这篇关于如何仅在ASP.NET中的调试模式下执行代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文