I have some piece of code called Finally()
which handles unhandled exceptions by subscribing to UnhandledException
event (I'm talking about WinForms).
AppDomain.CurrentDomain.UnhandledException += (_, __) => Finally(__.ExceptionObject as Exception);
Where should I put this line? Into the static Program()
constructor or into the static void Main()
method? Is there any differences?