檢核程式為單一應用
該程式碼為檢核程序是否為單一實例
System.Diagnostics.Process process = Process.GetCurrentProcess();
if (System.Diagnostics.Process.GetProcessesByName(process.ProcessName).Any(a => a.ProcessName == process.ProcessName && a.Id != process.Id))
{
Console.WriteLine("Another instance of the application is already running.");
return;
}