On this page... (hide)

http://www.codeproject.com/Tips/90646/Custom-exceptions-in-C-NET

 

Writing Custom Exception Classes the Quick Way

 

 

  1. Create a new class.
  2. inside the namespace definition of the new class, type
    1. Exception
  3. Press the tab key twice.

 

You then get the following code, free of charge:

 

[global::System.Serializable]
public class MyException : Exception {

  public MyException() { }
  public MyException(string message) : base(message) { }
  public MyException(string message, Exception inner) : base(message, inner) { }
  protected MyException(
  System.Runtime.Serialization.SerializationInfo info,
  System.Runtime.Serialization.StreamingContext context)
    : base(info, context) { }
}

 

See Also

Windows.Logging