on program shutdown c# code example
Example 1: shutdown system C#
Process.Start("shutdown","/s /t 0");
Example 2: shutdown system C#
var psi = new ProcessStartInfo("shutdown","/s /t 0");
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
Process.Start(psi);
// to avoid creating window