c# how to close application code example Example 1: how to exit a program in c# Application.Exit(); Example 2: c# how to close application Environment.Exit(0);