Description
If I use the following constructor of ArgumentOutOfRangeException class, the exception will inform the parameter name that causes the exception, along with a predefined system error message:
public ArgumentOutOfRangeException(string paramName)
Alternatively, if I use the following constructor, the exception will inform the parameter name, the argument value, and the specified error message:
public ArgumentOutOfRangeException(string paramName, object actualValue, string message)
Question
How to throw a predefined exception that inform the parameter name, the argument value, along with a predefined system error message?
I'm not confident with this one:
public static int Test(int Number)
{
ArgumentOutOfRangeException argEx = new ArgumentOutOfRangeException();
throw ArgumentOutOfRangeException("Number", Number, argEx.Message);
}