[Mono-dev] DataTable Select string comparison patch

Jaroslaw Pawlak jarek.pawlak at gmail.com
Tue Dec 5 13:16:54 EST 2006


RE: [Mono-dev] DataTable Select string comparison patch
Hi Konstantin ,

>>>  1. If one object is string = "5 " and the second object is Int32 = 5. 
>>> Will
>>> the objects be equal?
>> No, they won't even go into the "if" because o1 is string, but o2 is not 
>> string
>That's right, but the question is what happens in MS .Net?
Well, MS .NET (at least 2.0)  treats '5' and int 5 as equal (in 
DataTable.Select).
I guess it means that a string from int is created (or int from string) to 
compare objects.
So it seems that object creation takes place anyway.

>> >  3. Trimming + converting [...]
>while (count1 > 0 && Char.IsWhiteSpace(s1[count1 - 1])) count1--;
Maybe you're right, I can change trim to counting spaces, but if you want 
also have 5 == '5' done, then in my opinion you will not escape from 
creating objects.
If we agree to string creation in one place I don't see reason not to agree 
to create another (trimmed).

>And the last thing, the DataTable.Locale should be taken into account.
I'm mostly interested in my "trimming" problem, because I need this to work. 
I don't want to go too far from it right now.

Regards,
Jarek 




More information about the Mono-devel-list mailing list