2

IDictionary<TKey, TValue>

ArgumentNullException - key is null.

Then, in the remarks...

Implementations can vary in whether they allow key to be null.

So, I have to wonder... is this an error or something I'm just missing here? The MSDN help file seems a bit contradictory.

myermian
  • 31,823
  • 24
  • 123
  • 215

2 Answers2

6

What the documentation says is "If you get ArgumentNullException, then key was null".

It does not say "If key is null, you get an ArgumentNullException." That would be an converse logic fallacy.

The complete condition would be:

"If and only if both key is null and the container does not support null keys, you get an ArgumentNullException."

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
  • incidentally i notice that logic flaw to be the most common reason for invalid arguments (just in general in life, not programming) – Aaron Anodide Sep 12 '11 at 21:28
1

The table you're looking at is mapping Outcomes to the Conditions that caused them.

In this case, the exception is caused by a null argument.

Aaron Anodide
  • 16,906
  • 15
  • 62
  • 121