NotSupportedExceptionExtensions Class
Provides ThrowNew extension methods for NotSupportedException.
public static class NotSupportedExceptionExtensionsRemarks
Each public constructor of the exception type has two methods, with the parameters of the constructor. Call them on the exception type, as in NotSupportedException.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
| Name | Description |
|---|---|
| NotSupportedException.ThrowNew() | Throws a new NotSupportedException. |
| NotSupportedException.ThrowNew(string?) | Throws a new NotSupportedException. |
| NotSupportedException.ThrowNew(string?, Exception?) | Throws a new NotSupportedException. |
| NotSupportedException.ThrowNew<T>() | Throws a new NotSupportedException, where the code needs an expression of type T. |
| NotSupportedException.ThrowNew<T>(string?) | Throws a new NotSupportedException, where the code needs an expression of type T. |
| NotSupportedException.ThrowNew<T>(string?, Exception?) | Throws a new NotSupportedException, where the code needs an expression of type T. |
NotSupportedException.ThrowNew overloads
NotSupportedException.ThrowNew()
Throws a new NotSupportedException.
extension(NotSupportedException)
{
public static void ThrowNew()
}NotSupportedException.ThrowNew(string?)
Throws a new NotSupportedException.
extension(NotSupportedException)
{
public static void ThrowNew(string? message)
}NotSupportedException.ThrowNew(string?, Exception?)
Throws a new NotSupportedException.
extension(NotSupportedException)
{
public static void ThrowNew(string? message, Exception? innerException)
}Parameters
messagestring?- The error message that explains the reason for the exception.
innerExceptionException?- The exception that is the cause of the current exception. If the
innerExceptionparameter is not a null reference, the current exception is raised in acatchblock that handles the inner exception.
NotSupportedException.ThrowNew<T>()
Throws a new NotSupportedException, where the code needs an expression of type T.
extension(NotSupportedException)
{
public static T ThrowNew<T>()
}Type parameters
T- The type of the expression.
Returns
T This method does not return.
NotSupportedException.ThrowNew<T>(string?)
Throws a new NotSupportedException, where the code needs an expression of type T.
extension(NotSupportedException)
{
public static T ThrowNew<T>(string? message)
}Type parameters
T- The type of the expression.
Parameters
messagestring?- A
Stringthat describes the error. The content ofmessageis intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
Returns
T This method does not return.
NotSupportedException.ThrowNew<T>(string?, Exception?)
Throws a new NotSupportedException, where the code needs an expression of type T.
extension(NotSupportedException)
{
public static T ThrowNew<T>(string? message, Exception? innerException)
}Type parameters
T- The type of the expression.
Parameters
messagestring?- The error message that explains the reason for the exception.
innerExceptionException?- The exception that is the cause of the current exception. If the
innerExceptionparameter is not a null reference, the current exception is raised in acatchblock that handles the inner exception.
Returns
T This method does not return.