[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [DotGNU]fxcop
From: |
Marcus |
Subject: |
Re: [DotGNU]fxcop |
Date: |
Fri, 30 Apr 2004 15:51:26 -0500 |
User-agent: |
KMail/1.6.2 |
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 ?