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;
        }

    }
}

原文地址:https://www.cnblogs.com/Tpf386/p/13073471.html