[c#] public static process runninginstance() { process current = process.getcurrentprocess(); process[] processes = process.getprocessesbyname (current.processname); //查找相同名称的进程 foreach (process process in processes) { //忽略当前进程 if (process.id != current.id) { //确认相同进程的程序运行位置是否一样. if (assembly.getexecutingassembly().location.replace("/", "//") == current.mainmodule.filename) { //return the other process instance. return process; } } } //no other instance was found, return null. return null; }