當異常發生時我要重新啓動所有的處理或啓動主要方法,這另一種方法後:如何調用主要方法或重新啓動應用程序控制臺?
public void DisplayMessage(string message) {
Console.WriteLine(message, "Rebuild Log Files");
Console.WriteLine(" Press Enter to finish, or R to restar the program...");
string restart = Console.ReadLine();
if(restart.ToUpper() == "R") {
//Call the Main method or restart the app
}
Console.ReadKey();
}
注:主要的方法中包含了一些用戶寫入的數據。
我該怎麼做?
您可能想編輯您的文章,並使用代碼示例按鈕設置您的代碼的格式。這是帶兩個大括號的那個{} – 2011-04-18 18:12:43
爲什麼要發佈類似的問題兩次? http://stackoverflow.com/questions/5707011/how-call-the-main-method-or-restar-the-app-console – Chandu 2011-04-18 18:13:46
在這部分我需要重新啓動控制檯應用程序,例如:Application.Restart() ,或Main(string [] args);或類似的東西 – ale 2011-04-18 18:15:27