- Derive custom exceptions from System.Exception or one of the other base exception types (but not System.ApplicationException).
- Suffix custom exception type names with “Exception”
- Make exceptions serialisable, so they can cross remoting and application domain boundaries.
- Provide the following constructors on all custom exceptions, and use the same parameter names and types:
[Serializable]
public class CustomException : Exception, ISerializable
{
public CustomException(){}
public CustomException(string message) { }
public CustomException(string message, Exception inner) { }
// This is required for serialisation
protected CustomException(SerializationInfo info, StreamingContext context) { }
}