You can run it in a separate thread.
new Thread(() => Console.Beep()).Start();
I woke up this morning to find a flurry of comments on the subject. So I thought that I would have something in common with some other ideas.
, .
Action beep = Console.Beep;
beep.BeginInvoke((a) => { beep.EndInvoke(a); }, null);
, EndInvoke , BeginInvoke, .
MSDN: . EndInvoke .
http://msdn.microsoft.com/en-us/library/2e08f6yc(VS.80).aspx
Beep (. ). . , 1 maxStackSize, , ( 1, ) , . MSDN .
class BackgroundBeep
{
static Thread _beepThread;
static AutoResetEvent _signalBeep;
static BackgroundBeep()
{
_signalBeep = new AutoResetEvent(false);
_beepThread = new Thread(() =>
{
for (; ; )
{
_signalBeep.WaitOne();
Console.Beep();
}
}, 1);
_beepThread.IsBackground = true;
_beepThread.Start();
}
public static void Beep()
{
_signalBeep.Set();
}
}
, , ,
BackgroundBeep.Beep();