例外処理



独自の例外クラス

Exceptionクラスを継承する。
ほとんど中身は不要だが、継承元に引数を渡す為、コンストラクタのみ書く
    /// <summary>FooBarの例外</summary>
    public class FooBarException : Exception
    {
        /// <summary>FooBarExceptionコンストラクタ</summary>
        public FooBarException() { }

        /// <summary>FooBarExceptionコンストラクタ(string)</summary>
        public FooBarException(string message)
                : base(message) { }

        /// <summary>FooBarExceptionコンストラクタ(string, Exception)</summary>
        public FooBarException(string message, Exception innerException)
                : base(message, innerException) { }
    }

最終更新:2009年08月17日 11:29