how to exit on c# code example Example 1: exit programm c# Application.Exit(); Example 2: c# program exit System.Windows.Forms.Application.ExitThread( )