Singleton problem in c#

Possible Duplicates:
What is the correct way to create a single instance application?
What is a good pattern for using a Global Mutex in C#?

Suppose i have created an exe i want that exe must run only once ..how it is possible please give suggestion


If I understand your problem correctly this has nothing to do with having a singleton implementation. You simply need to check if your executable is currently running.

You can do this by calling Process.GetProcesses() or Process.GetProcessesByName(NameOfExecutable) and checking the return values.

Alternatively use a Mutex as suggested above by others.


你可以看看这篇文章。

链接地址: http://www.djcxy.com/p/51150.html

上一篇: 使用已运行的应用程序

下一篇: C#中的单例问题