C# 自定义异常

// 自定义异常,继承自Exception
 public class MyException : Exception
 {
        public override string Message
        {
            get { return "开始日期或者结束日期格式不正确"; }
         }
}
 
在需要用的时候抛出
throw new MyException();
posted @ 2018-01-27 09:26  _NickWang  阅读(277)  评论(0编辑  收藏  举报