c# application exit code example

Example 1: exit programm c#

Application.Exit();

Example 2: how to exit application c# console

System.Environment.Exit(0);
// or
Environment.Exit(0);

Example 3: c# exit application

// In a console application:
Environment.Exit(0);
// In a WPF application:
Close();

Example 4: how to exit a program in c#

Application.Exit();

Example 5: c# application exit

private void button1_Click(object sender, EventArgs e) // this is your button double click your button and you will find it
        {
            Application.Exit();
        }

Example 6: c# application exit

application.exit