Click here to Skip to main content
Click here to Skip to main content
Alternative Tip/Trick

Tagged as

Does Your App Know Where it's Running

, 3 Feb 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
I use the following to insert pauses into console apps when they are vs hosted. In fact it's the final lines in my standard template for a console app to ensure that the console stays visible until I dismiss it.if (AppDomain.CurrentDomain.FriendlyName.EndsWith("vshost.exe",...
I use the following to insert pauses into console apps when they are vs hosted. In fact it's the final lines in my standard template for a console app to ensure that the console stays visible until I dismiss it.
if (AppDomain.CurrentDomain.FriendlyName.EndsWith("vshost.exe", StringComparison.OrdinalIgnoreCase)) {
  // you are vs hosted
  Console.WriteLine("Press a key to continue...");
  Console.ReadLine();
}
 
Alan.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Alan N
Engineer
United Kingdom United Kingdom
There were these two guys at work who programmed a product costing programme on the new Wang (10Meg Winchester). I looked at their spaghetti and thought uhh, what's going on there. That was while ago, as I see that the spiral bound Wang Professional Computer Series "Basic Language Guide" Third Edition, which I've just pulled off the bookshelf, was published in 1985.
 
Shortly after that "the corporation" upgraded to the heavenly Amstrad 1512's (20Meg). Paul and I cracked the password file and I was really keen on creating a key logger but decided that I wanted to keep my job instead.
 
Way before all of this my cousin had a computer and although I can't remember what make it was, it seems that his programming pinnacle was making the lights on it's front panel flash on and off. At the time I was more interested in Lego. Happy days.
 
Back to the Wang, if that not too rude a phrase, I remember that our IT professional programmed F1 to enter the mainframe password because no one knew what it was!
 
Most embarrassing computer moment... Having to admit that it was me who had typed del c:\*.*

Comments and Discussions

 
GeneralMy vote of 1 Pinmemberjustpower25-Oct-13 17:33 
GeneralNice! PinsubeditorWalt Fair, Jr.15-Aug-11 16:20 
GeneralThat's deserving of its own tip. PinmvpJohn Simmons / outlaw programmer3-Feb-11 22:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141223.1 | Last Updated 3 Feb 2011
Article Copyright 2011 by Alan N
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid