class Program
{
static void Main(string[] args)
{
bool isAppRunning = false;
System.Threading.Mutex mutex = new System.Threading.Mutex(true, System.Diagnostics.Process.GetCurrentProcess().ProcessName, out isAppRunning);
if (!isAppRunning)
{
Console.Write("本程序已经在运行了,请不要重复运行!");
Environment.Exit(1);
}
Console.WriteLine("heihei");
Console.ReadKey();
}
}
c# 控制台程序单例运行
最新推荐文章于 2022-10-20 11:39:03 发布