Complete the code to declare a custom exception class named MyException.
public class MyException : [1] { }
The custom exception class should inherit from Exception to behave like a standard exception.
Complete the constructor to call the base Exception constructor with a message.
public class MyException : Exception { public MyException(string message) : [1](message) { } }
Use base to call the constructor of the parent Exception class with the message.
Fix the error in the custom exception class by adding the missing constructor for serialization.
using System; using System.Runtime.Serialization; [Serializable] public class MyException : Exception { public MyException(string message) : base(message) { } protected MyException(SerializationInfo info, [1] context) : base(info, context) { } }
The protected constructor for serialization requires a StreamingContext parameter.
Fill both blanks to complete the custom exception class with a default constructor and a message constructor.
public class MyException : Exception { public MyException() : [1]() { } public MyException(string message) : [2](message) { } }
Both constructors should call the base Exception constructors using base.
Fill all three blanks to complete the custom exception class with default, message, and serialization constructors.
using System; using System.Runtime.Serialization; [Serializable] public class MyException : Exception { public MyException() : [1]() { } public MyException(string message) : [2](message) { } protected MyException(SerializationInfo info, [3] context) : base(info, context) { } }
The default and message constructors call base, and the serialization constructor uses StreamingContext as the parameter type.