ArgumentOutOfRangeExceptionExtensions Class
Provides ThrowNew extension methods for ArgumentOutOfRangeException.
public static class ArgumentOutOfRangeExceptionExtensionsRemarks
Each public constructor of the exception type has two methods, with the parameters of the constructor. Call them on the exception type, as in ArgumentOutOfRangeException.ThrowNew(paramName).
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
ArgumentOutOfRangeException.ThrowNew overloads
ArgumentOutOfRangeException.ThrowNew()
Throws a new ArgumentOutOfRangeException.
extension(ArgumentOutOfRangeException)
{
public static void ThrowNew()
}ArgumentOutOfRangeException.ThrowNew(string?)
Throws a new ArgumentOutOfRangeException.
extension(ArgumentOutOfRangeException)
{
public static void ThrowNew(string? paramName)
}Parameters
paramNamestring?- The name of the parameter that causes this exception.
ArgumentOutOfRangeException.ThrowNew(string?, Exception?)
Throws a new ArgumentOutOfRangeException.
extension(ArgumentOutOfRangeException)
{
public static void ThrowNew(string? message, Exception? innerException)
}Parameters
messagestring?- The error message that explains the reason for this exception.
innerExceptionException?- The exception that is the cause of the current exception, or a null reference (
Nothingin Visual Basic) if no inner exception is specified.
ArgumentOutOfRangeException.ThrowNew(string?, object?, string?)
Throws a new ArgumentOutOfRangeException.
extension(ArgumentOutOfRangeException)
{
public static void ThrowNew(string? paramName, object? actualValue, string? message)
}ArgumentOutOfRangeException.ThrowNew(string?, string?)
Throws a new ArgumentOutOfRangeException.
extension(ArgumentOutOfRangeException)
{
public static void ThrowNew(string? paramName, string? message)
}ArgumentOutOfRangeException.ThrowNew<T>()
Throws a new ArgumentOutOfRangeException, where the code needs an expression of type T.
extension(ArgumentOutOfRangeException)
{
public static T ThrowNew<T>()
}Type parameters
T- The type of the expression.
Returns
T This method does not return.
ArgumentOutOfRangeException.ThrowNew<T>(string?)
Throws a new ArgumentOutOfRangeException, where the code needs an expression of type T.
extension(ArgumentOutOfRangeException)
{
public static T ThrowNew<T>(string? paramName)
}Type parameters
T- The type of the expression.
Parameters
paramNamestring?- The name of the parameter that causes this exception.
Returns
T This method does not return.
ArgumentOutOfRangeException.ThrowNew<T>(string?, Exception?)
Throws a new ArgumentOutOfRangeException, where the code needs an expression of type T.
extension(ArgumentOutOfRangeException)
{
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 this exception.
innerExceptionException?- The exception that is the cause of the current exception, or a null reference (
Nothingin Visual Basic) if no inner exception is specified.
Returns
T This method does not return.
ArgumentOutOfRangeException.ThrowNew<T>(string?, object?, string?)
Throws a new ArgumentOutOfRangeException, where the code needs an expression of type T.
extension(ArgumentOutOfRangeException)
{
public static T ThrowNew<T>(string? paramName, object? actualValue, string? message)
}ArgumentOutOfRangeException.ThrowNew<T>(string?, string?)
Throws a new ArgumentOutOfRangeException, where the code needs an expression of type T.
extension(ArgumentOutOfRangeException)
{
public static T ThrowNew<T>(string? paramName, string? message)
}