Monday, September 9, 2013

Pet Peeve #1

Calling ToString() on an object that is already typed as a String.  I see this in all sorts of situations, but this morning it was when accessing a configuration value:

AppSettings is a NameValueCollection.  When accessing its this[string name] or this[int index] properties, it returns a String.  Don’t give future developers more code that they have to read and subsequently ignore, that doesn’t add to readability.