Why does KeyNotFoundException not tell you what key?

  • Thread starter Thread starter Ethan Strauss
  • Start date Start date
E

Ethan Strauss

Guest
Hi,

This is really a complaint, but if there is a good reason, I would like to know...

When C#.net throws a KeyNotFoundException, it doesn't tell you the value of the key which was not found. Why is that? It would be easy to write the exception code to include key.ToString() and, for me at least, it would frequently simplify my debugging.

I find similar things for many exceptions where they seem to supply minimal info about the context of what when wrong. When I throw exceptions I generally try to add as much context as possible.

Thanks,

Ethan




Ethan Strauss

Continue reading...
 
Back
Top