C# Environment FailFast(String)
Description
Environment FailFast(String)
immediately terminates
a process after writing a message to the Windows Application event log, and
then includes the message in error reporting to Microsoft.
Syntax
Environment.FailFast(String)
has the following syntax.
public static void FailFast(
string message
)
Parameters
Environment.FailFast(String)
has the following parameters.
message
- A message that explains why the process was terminated, or null if no explanation is provided.
Returns
Environment.FailFast(String)
method returns
Example
The following example writes a log entry to the Windows Application event log and terminates the current process.
/* w ww .jav a 2 s .c o m*/
using System;
class Sample
{
public static void Main()
{
string causeOfFailure = "A failure has occured.";
try {
Environment.FailFast(causeOfFailure);
}finally{
Console.WriteLine("This finally block will not be executed.");
}
}
}
The code above generates the following result.