Every now and again, you need to restart a Raspberry Pi from within your application. This is typically done after making changes to the Pi configuration, issuing commands to enable or disable GPIO pins and many other things.
Fortunately, if you are writing your code using C# – and I am – this is straightforward. You simply write the following statements: –
System.Diagnostics.Process.Start(new ProcessStartInfo() {FileName = "sudo", Arguments = "reboot"});
This issues the sudo command and passes the reboot command to it as an argument.