c# quit app code example Example: c# exit application // In a console application: Environment.Exit(0); // In a WPF application: Close();