Click here to Skip to main content
15,898,222 members
Home / Discussions / C#
   

C#

 
Generalturbo c Pin
Alvin142-Jan-05 4:17
Alvin142-Jan-05 4:17 
GeneralRe: turbo c Pin
Alex Korchemniy2-Jan-05 6:01
Alex Korchemniy2-Jan-05 6:01 
GeneralRe: turbo c Pin
Matt Gerrans3-Jan-05 13:24
Matt Gerrans3-Jan-05 13:24 
GeneralNamespace Extensions for Windows Explorer Pin
GeloSoft2-Jan-05 2:50
GeloSoft2-Jan-05 2:50 
Generaltrying to find a conversion of c to c#... Pin
RonBou2-Jan-05 2:08
RonBou2-Jan-05 2:08 
GeneralRe: trying to find a conversion of c to c#... Pin
DavidNohejl2-Jan-05 2:22
DavidNohejl2-Jan-05 2:22 
GeneralRe: trying to find a conversion of c to c#... Pin
RonBou2-Jan-05 15:50
RonBou2-Jan-05 15:50 
GeneralRe: trying to find a conversion of c to c#... Pin
Matt Gerrans3-Jan-05 17:33
Matt Gerrans3-Jan-05 17:33 
I hope your goal is to be able to return a value (or errorlevel) from a console app, rather than to be able to exit your program from all sorts of odd places. If so the best way is to have a return value from Main(), like so:

namespace Demo
{
   class ReturnErrorLevel
   {
      public static int Main( string [] args )
      {
         if( args.Length == 1 )
            try
            {
               return int.Parse(args[0]);
            }
            catch( System.Exception ex )
            {
               System.Console.WriteLine(ex.ToString());
            }
         return 0;
      }
   }
}


Yes, I know most people are only interested in the "answer" and not any advice or opinions, but on this one I must persist. I once got a DLL from another group in the same company and after using some facilities in it, my app would seemingly crash -- just disappear. It was driving me nuts. Mad | :mad: Looking through the source code, I discovered that in many different cases, it would do whatever calculations were required, print to standard out (another silly thing for a DLL to be doing) and exit(). WTF | :WTF:

Exiting from all over your app is like having a large function with tons of returns, or gotos. Life is a lot simpler if the app exits from one place -- at the end of the main entrypoint.

Matt Gerrans
QuestionAvalon CTP "Preview" events ? Pin
Andres Coder2-Jan-05 1:34
Andres Coder2-Jan-05 1:34 
GeneralHandle without class Pin
eggie52-Jan-05 0:16
eggie52-Jan-05 0:16 
GeneralRe: Handle without class Pin
Stefan Troschuetz2-Jan-05 1:41
Stefan Troschuetz2-Jan-05 1:41 
GeneralRe: Handle without class Pin
eggie52-Jan-05 8:28
eggie52-Jan-05 8:28 
GeneralRe: Handle without class Pin
Stefan Troschuetz2-Jan-05 11:00
Stefan Troschuetz2-Jan-05 11:00 
GeneralC# Class Member Coding Practice Poll Pin
Rocky Moore1-Jan-05 21:33
Rocky Moore1-Jan-05 21:33 
GeneralListView Pin
Blue_Skye1-Jan-05 19:17
Blue_Skye1-Jan-05 19:17 
GeneralRe: ListView Pin
Adam Goossens1-Jan-05 19:21
Adam Goossens1-Jan-05 19:21 
GeneralStop Form Copies Pin
myNameIsRon1-Jan-05 12:20
myNameIsRon1-Jan-05 12:20 
GeneralRe: Stop Form Copies Pin
TyronX1-Jan-05 12:42
TyronX1-Jan-05 12:42 
GeneralRe: Stop Form Copies Pin
Adam Goossens1-Jan-05 19:18
Adam Goossens1-Jan-05 19:18 
QuestionTypecode of an Array? Pin
TyronX1-Jan-05 10:30
TyronX1-Jan-05 10:30 
AnswerRe: Typecode of an Array? Pin
TyronX1-Jan-05 10:37
TyronX1-Jan-05 10:37 
AnswerRe: Typecode of an Array? Pin
Adam Goossens1-Jan-05 15:07
Adam Goossens1-Jan-05 15:07 
AnswerRe: Typecode of an Array? Pin
leppie1-Jan-05 17:56
leppie1-Jan-05 17:56 
Questionusing windows media format & encoder API? Pin
Member 16179991-Jan-05 9:14
Member 16179991-Jan-05 9:14 
GeneralJoystick control again Pin
TyronX1-Jan-05 4:22
TyronX1-Jan-05 4:22 

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

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