[Mono-dev] RE: [Mono-devel-list] System.Data : DataTable.Select performance
tsureshkumar
tsureshkumar at novell.com
Mon Sep 19 09:56:01 EDT 2005
Boris Kirzner wrote:
> Hello Suresh,
>
>
>>@@ -193,9 +206,14 @@
>> return false;
>> }
>>- if (_filter != filter)
>>- return false;
>>+ if (_filter != null) {
>>+ if (!_filter.Equals (filter))
>>+ return false;
>>+ }
>>+ else if (filter != null)
>>+ return false;
>>
>>=======================================================
>>please review this conditional checking.
>>=======================================================
>
>
> I've reviewed it and it seems ok. Can you point to some specific problem
> in this code?
>
>
First thing is that this whole code above can be simplified into
if (_filter != null && !_filter.Equals (filter))
return false;
and also, this logic is wrong. if you are looking for a non-null filter,
an index with null filter would also match up.
So, IMO, it should be
if ( (_filter != null && !_filter.Equals (filter)) /* equals compare
*/ || (_filter != filter)) /* null compare */
return false;
Please let me know if you have thought otherwise.
suresh.
More information about the Mono-devel-list
mailing list