当前位置: 移动技术网 > IT编程>开发语言>c# > C# Debugger.IsAttached 调试启动浏览器 VS if DEBUG 启动调试内容

C# Debugger.IsAttached 调试启动浏览器 VS if DEBUG 启动调试内容

2020年05月09日  | 移动技术网IT编程  | 我要评论
1. 程序集 Debugger:调试类 引用集:System.Diagnostics.Debug.dll 2. 方法使用 1.调用系统默认的浏览器方法: //调用系统默认的浏览器 System.Diagnostics.Process.Start("http://blog.csdn.net/testc ...

1. 程序集

debugger:调试类

引用集:system.diagnostics.debug.dll

2. 方法使用

1.调用系统默认的浏览器方法:

//调用系统默认的浏览器 
system.diagnostics.process.start("http://blog.csdn.net/testcs_dn");

2. debugger.isattached 调试启动浏览器

if (debugger.isattached)
  {
      system.diagnostics.process.start($"{baseaddress}/swagger");  //调试启动浏览器
   } 

3.if debug  启动调试内容

#if debug
       string baseaddress = "http://localhost:9000/";
#endif

3. 项目使用实例

4. #if debug vs system.diagnostics.debugger.isattached

在visual studio中使用#if debug system.diagnostics.debugger.isattached在visual studio中有什么区别?是否存在debug设置了标志但没有附加调试器的情况,或者在debug未设置标志的情况下可以附加调试器的情况?

如您对本文有疑问或者有任何想说的,请 点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网