How to determine whether code is getting executed in a console app or in a windows service?
views:
59answers:
1
+3
A:
Whilst it's not console specific (i.e. this will return true when running as a winforms app as well) I've used the following
if (Environment.UserInteractive)
{
Console.WriteLine("Hi I'm being ran as a console app");
}
blowdart
2009-08-25 04:50:24