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

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