Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

winforms

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

like image 699
odiseh Avatar asked Jan 05 '10 07:01

odiseh


People also ask

Which C version is best?

Yes, it's a bit odd that you can get a loud consensus that K&R is a great C book, and also a loud consensus that C99 is the correct/current/best version of C.

What is the best way to learn C Quora?

step 1:Understand the problem by reading several times until you understand. step 2: Think logic of the problem. step 3: Put a pen on paper and write algorithm for that problem by applying your logic. step 4:Then convert the algorithm in C code.


2 Answers

if (System.Diagnostics.Debugger.IsAttached) {     // You are debugging } 
like image 175
Webleeuw Avatar answered Sep 20 '22 16:09

Webleeuw


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;     } } 
like image 26
mkus Avatar answered Sep 23 '22 16:09

mkus