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