On 28 July 2011 11:24, DotNet Dude <adotnetd...@gmail.com> wrote:
> On Tue, Jul 26, 2011 at 11:59 PM, Les Hughes <l...@datarev.com.au> wrote:
>> James Chapman-Smith wrote:
>>>
>>> Hi David,
>>>
>>> What do you mean by incredibly slow? How many buttons are we talking
>>> about?
>>>
>>> I just did a test with 1000 buttons and it took 3.47 milliseconds. With
>>> 5000 buttons it was 16.78 milliseconds.
>>>
>>> Did I miss something?
>>>
>>> Cheers.
>>>
>>> James.
>>>
>>
>> I'm with you James.
>>
>> I usually do something like (psuedoish)
>>
<snip>
>>       if (b.Name.ToString().ToLower().Trim() = "foo") b.Text = "bar";
>
> IMO
> 1) ToSring is unnecessary
>  2) Trim is unnecessary
> 3)  Use String.Compare rather than ToLower and then equality compare
>
I agree with all those points, but if you /are/ using the
.ToLower-like comparison, you should use .ToUpperInvariant, because it
caters for more special cases.
<snip>

-- 
Regards,
Mark Hurd, B.Sc.(Ma.)(Hons.)

Reply via email to