Re: fxcop

Marcus <[email protected]>
Newsgroups gmane.comp.gnu.dotgnu.developer
Message-ID <[email protected]>
The "if (val.Length == 0)" does not seem very intuitive in the context of 
determine whether a string is empty or not. A better solution would seem to 
be to optimize the comparison of "if (val == String.Empty)".

Also, my understanding was that all string constants declared in a program 
would be interned, so that a simple pointer comparison could be done.

Given all that, I'm not sure why the val.Length version is so much faster.


On Friday 30 April 2004 8:06 am, Gopal V wrote:
> Compare
>
> if(val.Length == 0)
>
> and
>
> if(val == String.Empty)
>
> tell me which gives an exception when val is null ?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.