我有
try
{
using (var eventWaitHandle = EventWaitHandle.OpenExisting(name))
{
eventWaitHandle.Set();
}
Environment.Exit(0);
}
catch(WaitHandleCannotBeOpenedException)
{
// register new handle code goes here
}
有没有办法在不抛出/处理异常的情况下做到这一点?