C#重启程序

               //程序位置
                        string strAppFileName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
                        System.Diagnostics.Process myNewProcess = new System.Diagnostics.Process();
                        //要启动的应用程序
                        myNewProcess.StartInfo.FileName = strAppFileName;
                        // 设置要启动的进程的初始目录
                        myNewProcess.StartInfo.WorkingDirectory = Application.ExecutablePath;
                        //启动程序
                        myNewProcess.Start();
                        //结束该程序
                        Application.Exit();
                        //结束该所有线程
                        Environment.Exit(0);