c# how to exit an application code example Example 1: exit programm c# Application.Exit(); Example 2: c# how to exit program System.Environment.Exit(1);