Mega Code Archive

 
Categories / C# / Development Class
 

Immediately terminates a process after writing a message to the Windows Application event log

using System; class Sample {     public static void Main()     {         string causeOfFailure = "this is a test.";         try         {             Environment.FailFast(causeOfFailure);         }         finally         {             Console.WriteLine("This finally block will not be executed.");         }     } }