British Inside

An Englishman living in small town America

James Shaw

News

  • Copyright James Shaw 2004-2007

    Creative Commons License

    View James Shaw's profile on LinkedIn

Focussing on the wrong problem

I just got this error when calling List<x>.RemoveRange(pos, int.MaxValue):

Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.

What's the point of that? Why on earth wouldn't you just delete to the end of the array and be done with it?

*sigh*

So now you make callers calculate the number of elements to delete.. was that count-pos+1, or count-pos...hmmm

If they were writing safe code in the first place (and I'm sure they are) you just know the code would probably work with the inputs I gave it - so someone deliberately put a test and a string resource into the project because they figured I needed a slap.

Well, so-rry! 


 

Posted: Friday, January 18, 2008 3:52 PM by James
Filed under: ,

Comments

No Comments

New Comments to this post are disabled