Navigation
Links

Powered by Squarespace
« Internal NullReferenceException in HttpWebRequest when using a CachePolicy | Main | WCF: Service Name »
Wednesday
Mar142007

What happened here?

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:

  1. Why are there three names used to represent paramName?

  2. Why was the parameter order changed in the child classes?

References (1)

References allow you to track sources for this article, as well as articles that were written in response to this article.

Reader Comments (1)

I think that conversation played out something like this.

Left Hand: Hey Right, what are you up to?
Right Hand: I told you yesterday.
Left Hand: What? No you didn't
Right Hand: Dude, do you even listen to me when I talk?
Left Hand: Dammit Right, I don't have time to listen to you blather on about your empty existance.
Right Hand: *slumps head and frowns* bbbut, I thought you cared *whimper*

March 14, 2007 | Unregistered CommenterJoel Martinez

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>