简体   繁体   English

在c#中确定程序员是通过IDE还是用户运行程序的最佳方法是什么?

[英]What is the best way in c# to determine whether the programmer is running the program via IDE or it's user?

在c#中确定程序员是通过IDE还是用户运行程序的最佳方法是什么?

if (System.Diagnostics.Debugger.IsAttached) {
    // You are debugging
}
public static bool IsInVisualStudio
{
    get
    {
        bool inIDE = false;
        string[] args = System.Environment.GetCommandLineArgs();
        if (args != null && args.Length > 0)
        {
            string prgName = args[0].ToUpper();
            inIDE = prgName.EndsWith("VSHOST.EXE");
        }
        return inIDE;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在C#中,确定数据库是否已启动并正在运行的最佳方法是什么? - In C# what is the best way to determine if a database is up and running? 在C#中确定未修剪字符串是否为空的最有效方法是什么? - What's the most efficient way to determine whether an untrimmed string is empty in C#? 让用户在 C# 中选择子目录的最佳方法是什么? - What's the best way to let a user pick a subdirectory in C#? 允许用户在C#中浏览文件的最佳方法是什么? - What's the best way to allow a user to browse for a file in C#? 解释ac#program的最佳方法是什么? - what is the best way to explain a c# program? C# TcpClient - 客户端确定远程服务器是否正常关闭连接的最佳方法是什么? - C# TcpClient - What's the best way for a client to determine if remote server has gracefully shutdown connection? 在C#中,确定小数是否为“ int”的最佳方法是什么? - In C#, what is the best way to determine if a decimal “is an int”? 在 C# 中确定会话变量为 null 或为空的最佳方法是什么? - What is the best way to determine a session variable is null or empty in C#? C#确定继承接口类的最佳方法是什么? - C# What is the best way to determine the type of an inherited interface class? 通过C#网页发送大量电子邮件的最佳方式是什么? - What's the best way to send large amounts of email via C# Web page?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM