The basic requirement is that you add a new class to your project, which inherits from the built-in class System.Exception. This gives you almost everything you need for free, because it is implemented inside the class System.Exception.
The only thing you need to add to the class file is the constructors (because, remember, constructors are not inherited). Although you do not need to define all three standard constructors, I strongly recommend that you do this just to make your interface match all the exception classes provided by the .NET Framework. It is not so difficult to define them once, but it is recommended using code analysis tools .
( , , , ), . , SerializableAttribute Protected, . System.Exception .
, , :
''' <summary>
''' The exception that is thrown when DWM composition fails or is not
''' supported on a particular platform.
''' </summary>
<Serializable()> _
Public Class DwmException : Inherits System.Exception
''' <summary>
''' Initializes a new instance of the <see cref="DwmException"/> class.
''' </summary>
Public Sub New()
MyBase.New()
End Sub
''' <summary>
''' Initializes a new instance of the <see cref="DwmException"/> class
''' with the specified error message.
''' </summary>
''' <param name="message">The message that describes the error.</param>
Public Sub New(ByVal message As String)
MyBase.New(message)
End Sub
''' <summary>
''' Initializes a new instance of the <see cref="DwmException"/> class
''' with the specified error message and a reference to the inner
''' exception that is the cause of this exception.
''' </summary>
''' <param name="message">The message that describes the error.</param>
''' <param name="innerException">The exception that is the cause of the
''' current exception, or a null reference if no inner exception is
''' specified</param>
Public Sub New(ByVal message As String, ByVal innerException As System.Exception)
MyBase.New(message, innerException)
End Sub
' Constructor required for serialization
<SecuritySafeCritical()> _
Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)
MyBase.New(info, context)
End Sub
End Class
Ahh, , , . ( ) , , . , , ... .
. , , - (, .DLL), , - , . , DwmException , , DWM . NotSupportedException, , .
, (.. ), / . . , , , , " " ( ), .