C# - Environment.FailFast() Method with Example

In this tutorial, we will learn about the C# Environment.FailFast() method with its definition, usage, syntax, and example. By Nidhi Last updated : March 30, 2023

Environment.FailFast() Method

The Environment.FailFast() method is used to terminate the process immediately after writing the Windows application event log.

Syntax

void Environment.FailFast(string eventLog);

Parameter(s)

  • eventLog: a message that will be logged in the windows application event log.

Return Value

This method does not return any value.

C# Example of Environment.FailFast() Method

The source code to demonstrate the use of FailFast() method of Environment class is given below. The given program is compiled and executed successfully.

using System; class Sample { //Entry point of Program static public void Main() { Console.WriteLine("Program before termination of process"); Environment.FailFast("Terminate program by Me"); Console.WriteLine("Program after termination of process"); } }

Output

Program before termination of process
Press any key to continue . . .

C# Environment Class Programs »





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.