> > Very much a personal preference thing - but I'd make the choice based
> > on readability rather than performance.
[quoted text clipped - 5 lines]
> they are 0 and return true, that is still two comparisons. Whereas I know
> that just checking if the length is 0 is only one comparison.
Show me *any* production application where that makes any significant
difference, and I'll buy you several pints. It's really not worth
bothering about.
> Another reason I dislike comparison with an empty string is that some people
> (read: other developers) don't appreciate that you get the odd stray spaces
> and that "" != " ". The fact that you are checking a zero length string
> makes it more obvious (to me anyway) that rogue spaces are not to be
> tolerated.
Okay, it reads pretty clearly to me - but this is where the personal
preference business kicks in.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Aidy - 14 Mar 2008 15:21 GMT
> Show me *any* production application where that makes any significant
> difference, and I'll buy you several pints. It's really not worth
> bothering about.
I've admitted it doesn't make a difference, it just comes down to personal
choice. However it seems you're not too keen when other's personal choice
differs from your personal choice!
Jon Skeet [C# MVP] - 14 Mar 2008 15:35 GMT
> > Show me *any* production application where that makes any significant
> > difference, and I'll buy you several pints. It's really not worth
[quoted text clipped - 3 lines]
> choice. However it seems you're not too keen when other's personal choice
> differs from your personal choice!
Not at all - I'm perfectly happy if people choose to use a different
approach based on their personal preference due to differing ideas of
readability.
If people choose to use one approach based on *performance* however,
they're using a completely bogus reason - and I'll call them on that.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk