Re: SortedList - bug or undocumented behavior ?
- From: "Jay B. Harlow" <Jay_Harlow_MVP@xxxxxxxxxxxxx>
- Date: Sat, 11 Nov 2006 10:51:08 -0600
Antonio,
In addition to the other comments:
then '@@', etc...Ascii codes for '?' and '@' are greater than '<' '=' '>'.
Remember .NET stores strings in Unicode, specifically UTF-16. UTF-16 means that the Unicode characters (which can be upto 32-bits) are stored as 16 bit values.
This is an excellent article on the perils & pitfalls of comparing strings in .NET 2.0:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/StringsinNET20.asp
By default strings are compared via the CurrentCulture. It sounds like you are expecting the strings to be compared via ASCII Ordinal, not even Unicode Ordinal.
--
Hope this helps
Jay B. Harlow
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Antonio Paglia" <tony@xxxxxxxxxxxxxxxx> wrote in message news:evWhNlzAHHA.3380@xxxxxxxxxxxxxxxxxxxxxxx
Hello. I have tried to insert this items into a SortedList.
dic = New SortedList
dic.Add("<<", "<<")
dic.Add("==", "==")
dic.Add(">>", ">>")
dic.Add("@@", "@@")
dic.Add("??", "??")
Debugging this peace of code I have notice that '??' appears as first item, then '@@', etc...Ascii codes for '?' and '@' are greater than '<' '=' '>'. May be this is a bug or an undocumented behavior ??
TIA
Antonio
.
- References:
- SortedList - bug or undocumented behavior ?
- From: Antonio Paglia
- SortedList - bug or undocumented behavior ?
- Prev by Date: Re: Extract Single Record from Dataset filled from SP Output
- Next by Date: Need to convert field msExchMailboxGuid in AD to HEX GUID
- Previous by thread: Re: SortedList - bug or undocumented behavior ?
- Next by thread: What do you call nested If...Then search loops?
- Index(es):
Relevant Pages
|