在msdn link中提到
不要拋出System.Exception或System.SystemException。
在我的代碼我舉辦這樣捕捉並拋出異常的最佳做法
private MsgShortCode GetshortMsgCode(string str)
{
switch (str.Replace(" ","").ToUpper())
{
case "QNXC00":
return MsgShortCode.QNXC00;
default:
throw new Exception("Invalid message code received");
}
}
這是一個不好的做法?