作者kingtw1978 (King)
看板C_Sharp
標題[問題] try , catch 找系統問題
時間Sun Oct 9 12:51:05 2005
用 try 和 catch 找系統bug問題
(1)如果我現在輸入的資料格式是錯誤的,就顯示 Bad input!
我在 catch 那邊寫
catch(這邊要怎麼寫?)
{
Console.WriteLine("Bad input!");
}
這樣寫 show 不出來 Bad input! 資訊.... @@
(2)如果只要顯示系統錯誤訊息,下面這樣就應該可以了吧
catch(System.Exception error)
{
Console.WriteLine(error.Message);
}
PS:對於 catch() 裡面的寫法還不是很了解
--
因看板太多不可能逐一觀看
麻煩各位回覆文章的時候也請順便回覆到我的信箱
http://blog.xuite.net/kingtw1978/blog
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 70.173.83.247
推 liunate:可以去MSDN看看關於 "例外處理" 的教學文章 10/09 14:27
推 tomex:catch() 10/14 16:26