![](/img/trans.png)
[英]In C# what is the best way to determine if a database is up and running?
[英]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.