C# 自定义异常demo

 

本文参考:C#自定义异常

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Cost.Entity.CommonModel.MyException
{
    /// <summary>
    /// 自定义数据类型异常
    /// </summary>
    public class MyDataException : System.ApplicationException
    {
        private string error;
        private System.Exception innerException;

        public MyDataException()
        {
        }

        public MyDataException(string msg)
            : base(msg)
        {
            this.error = msg;
        }

        public MyDataException(string msg, System.Exception innerException)
            : base(msg)
        {
            this.error = msg;
            this.innerException = innerException;
        }

    }
}

 

posted on 2020-06-09 16:31  荆棘人  阅读(175)  评论(0编辑  收藏  举报

导航