What happened here?
··1 min
Here’s a number of inconsistencies with exception constructors:
The message parameter is first and paramName is second for one of ArgumentException’s constructors.
public ArgumentException(string message, string paramName);
These exceptions inherit ArgumentException:
- In one of
ArgumentOutOfRangeException’s constructors, paramName is first and message is second.public ArgumentOutOfRangeException(string paramName, string message); - In one of
InvalidEnumArgumentException’s constructors, argumentName is used to represent the same value as paramName. This is an overload that doesn’t include the message parameter, which is normal.public InvalidEnumArgumentException(string argumentName, int invalidValue, Type enumClass); - In one of
DuplicateWaitObjectException’s constructors, parameterName is first, represents the same value as paramName, and message is second.public DuplicateWaitObjectException(string parameterName, string message);
Questions:
- Why are there three names used to represent paramName?
- Why was the parameter order changed in the child classes?