The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,977 other subscribers

Archive for July 28th, 2010

.NET/C#: a generic exception class

Posted by jpluimers on 2010/07/28

I want my exceptions to be bound to my business classes.
So you need your own exception class, and are expected to override the 4 constructors of the Exception class.

But I got a bit tired of writing code like this again and again:

using System;
using System.Runtime.Serialization;

namespace bo.Sandbox
    public class MyException : Exception
        public MyException()
            : base()

        public MyException(string message)
            : base(message)

        public MyException(string message, MyException inner)
            : base(message, inner)

        public MyException(SerializationInfo info, StreamingContext context)
            : base(info, context)

Searching for Generic Exception Class did not reveal any generic exception classes.
So I wrote this instead: Read the rest of this entry »

Posted in .NET, C#, C# 2.0, Development, Software Development | Leave a Comment »

%d bloggers like this: