2020-05-09

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

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


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/";

No comments:

Post a Comment