zoukankan      html  css  js  c++  java
  • 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/";
    #endif
    

    3. 项目使用实例

    4. #if DEBUG VS System.Diagnostics.Debugger.IsAttached

    在Visual Studio中使用#if DEBUG System.Diagnostics.Debugger.IsAttached在Visual Studio中有什么区别?是否存在DEBUG设置了标志但没有附加调试器的情况,或者在DEBUG未设置标志的情况下可以附加调试器的情况?

  • 相关阅读:
    Choosing the Type at Runtime
    User-Defined Components Must Be Capitalized
    Computed property names
    Controlled Components
    Handling Event
    State
    props
    Functional and Class Components
    招聘漂亮的员工
    Spread Syntax
  • 原文地址:https://www.cnblogs.com/qy1234/p/12857150.html
Copyright © 2011-2022 走看看