http://www.c-sharpcorner.com/UploadFile/akkiraju/difference-between-throw-exception-and-throw-clause/
Program is given in the above website. In the 1st example the output is not coming like as shown I don't know why it may be due to the different version of VS express. Not only that how trace is in the output without StackTrace is in code.
System.Exception was unhandled
Message=Original Exception occurred in ExceptionMethod
Source=TestingThrowExceptions
StackTrace:
at TestingThrowExceptions.Program.Main(String[] args) in C:\TestProjects\TestingThrowExceptions\TestingThrowExceptions\Program.cs:line 26
Loading
Posted Aug 2, 2013, 8:48 AM
VulpesPosted Aug 2, 2013, 8:06 AM
In this case we're adding the handler, My Handler, to the invocation list of the AppDomain.UnhandledException event so that, when this event fires, the handler will be called automatically.
See this link for details of this event which provides notifications for otherwise uncaught exceptions:
http://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception.aspx
As this is a special use of the += operator, there's no other way to write the code.
Posted Aug 2, 2013, 7:07 AM
currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);
x +=1 is in more detail expression can be written as x = x + 1. I wish to know is there any similar way to write the above code.
VulpesPosted Aug 2, 2013, 5:08 AM
I don't use VS 2012 Express (I prefer the 2010 edition) but apparently the Exception Assistant (as it was called) has been removed from the Express edition and you now need the Pro (or better) edition to use it. See this SO thread:
http://stackoverflow.com/questions/14542831/how-to-view-exception-details-in-visual-studio-express
However, you should be able to see what Akkiraju was talking about (the exception details will now be printed to the console) if you add the highlighted code to the program and press Ctrl + F5 to Start without debugging.
Notice that line 26 will now become 29:
Rajesh BPosted Aug 2, 2013, 4:12 AM
Posted Aug 1, 2013, 9:09 PM
VulpesPosted Aug 1, 2013, 5:08 PM
Now fire up Notepad and paste the contents of the clipboard into it.
You should find that the stack trace details are similar to what Akkiraju said they would be.