开发者

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

What is the best way in c# to determine whether the programmer is r开发者_Python百科unning the program via IDE or its user?


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;
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜