Win32ExceptionExtensions Class

Provides ThrowNew extension methods for Win32Exception.

public static class Win32ExceptionExtensions

Remarks

Each public constructor of the exception type has two methods, with the parameters of the constructor. Call them on the exception type, as in Win32Exception.ThrowNew(message).

The first method returns no value. Call it as a statement.

The second method has a type parameter, which is also its return type. Call it where the code needs an expression of that type.

See also

Methods

NameDescription
Win32Exception.ThrowNew()Throws a new Win32Exception.
Win32Exception.ThrowNew(int)Throws a new Win32Exception.
Win32Exception.ThrowNew(int, string?)Throws a new Win32Exception.
Win32Exception.ThrowNew(string?)Throws a new Win32Exception.
Win32Exception.ThrowNew(string?, Exception?)Throws a new Win32Exception.
Win32Exception.ThrowNew<T>()Throws a new Win32Exception, where the code needs an expression of type T.
Win32Exception.ThrowNew<T>(int)Throws a new Win32Exception, where the code needs an expression of type T.
Win32Exception.ThrowNew<T>(int, string?)Throws a new Win32Exception, where the code needs an expression of type T.
Win32Exception.ThrowNew<T>(string?)Throws a new Win32Exception, where the code needs an expression of type T.
Win32Exception.ThrowNew<T>(string?, Exception?)Throws a new Win32Exception, where the code needs an expression of type T.

Win32Exception.ThrowNew overloads

Win32Exception.ThrowNew()

Throws a new Win32Exception.

extension(Win32Exception)
{
    public static void ThrowNew()
}

Win32Exception.ThrowNew(int)

Throws a new Win32Exception.

extension(Win32Exception)
{
    public static void ThrowNew(int error)
}
Parameters
error int
The Win32 error code associated with this exception.

Win32Exception.ThrowNew(int, string?)

Throws a new Win32Exception.

extension(Win32Exception)
{
    public static void ThrowNew(int error, string? message)
}
Parameters
error int
The Win32 error code associated with this exception.
message string?
A detailed description of the error.

Win32Exception.ThrowNew(string?)

Throws a new Win32Exception.

extension(Win32Exception)
{
    public static void ThrowNew(string? message)
}
Parameters
message string?
A detailed description of the error.

Win32Exception.ThrowNew(string?, Exception?)

Throws a new Win32Exception.

extension(Win32Exception)
{
    public static void ThrowNew(string? message, Exception? innerException)
}
Parameters
message string?
A detailed description of the error.
innerException Exception?
A reference to the inner exception that is the cause of this exception.

Win32Exception.ThrowNew<T>()

Throws a new Win32Exception, where the code needs an expression of type T.

extension(Win32Exception)
{
    public static T ThrowNew<T>()
}
Type parameters
T
The type of the expression.
Returns

T This method does not return.

Win32Exception.ThrowNew<T>(int)

Throws a new Win32Exception, where the code needs an expression of type T.

extension(Win32Exception)
{
    public static T ThrowNew<T>(int error)
}
Type parameters
T
The type of the expression.
Parameters
error int
The Win32 error code associated with this exception.
Returns

T This method does not return.

Win32Exception.ThrowNew<T>(int, string?)

Throws a new Win32Exception, where the code needs an expression of type T.

extension(Win32Exception)
{
    public static T ThrowNew<T>(int error, string? message)
}
Type parameters
T
The type of the expression.
Parameters
error int
The Win32 error code associated with this exception.
message string?
A detailed description of the error.
Returns

T This method does not return.

Win32Exception.ThrowNew<T>(string?)

Throws a new Win32Exception, where the code needs an expression of type T.

extension(Win32Exception)
{
    public static T ThrowNew<T>(string? message)
}
Type parameters
T
The type of the expression.
Parameters
message string?
A detailed description of the error.
Returns

T This method does not return.

Win32Exception.ThrowNew<T>(string?, Exception?)

Throws a new Win32Exception, where the code needs an expression of type T.

extension(Win32Exception)
{
    public static T ThrowNew<T>(string? message, Exception? innerException)
}
Type parameters
T
The type of the expression.
Parameters
message string?
A detailed description of the error.
innerException Exception?
A reference to the inner exception that is the cause of this exception.
Returns

T This method does not return.