there are many ways, here is a simple one:Mutex mutex = new Mutex(false, "Thisshouldonlyrunonce");
bool Running = !mutex.WaitOne(0, false);
if (Running)
    // exit program, or ....