c# window on close code example Example 1: c# close window Application.Exit(); Example 2: c# window instantly close System.Console.ReadLine();