Re: How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- From: G. <G@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 7 Aug 2009 17:17:01 -0700
"Peter Duniho" wrote:
On Fri, 07 Aug 2009 16:22:01 -0700, G. <G@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I do not know what others think. But in my opinion, this sorting isIsn't this so sad and too bad? Why the string sort with defaultsettings
cannot sort these simple strings?
It can. It just happens to not sort them the way you think is the best.
broken.
It's quite clear that that's your opinion. But you are in the minority.
I am using the latest visual studio 2008 express with sp1. Do not know if
this is the case for other versions of VS.
Again, the sorting behavior is defined by the .NET Framework. It has
nothing to do with Visual Studio, or C#.
I would say that string sorting is
so basic and such a problem (default string sort is not what you expect)
is a
big surprise for me.
That you consider string sorting to be "basic" simply illustrates how
naïvely you're looking at the problem. String sorting is not nearly as
simple a problem as you appear to think it is.
I have to say that it is broken, if you have some strings with several -
or
hyphens in it, you cannot expect where it would put those strings.
Actually, you can. The sorting is 100% reproducible.
It is very
strange. I do not know how it sorts strings with - in it at all. It seems
pretty random.
It's not random.
One possible option here is to just let the control sort the way it does
now. That may be just as appropriate for some subset of your users as
the
sorting method you are trying to get instead.
Again, we do not know how the strings are sorted at all.
Yes, we do. I quoted MSDN and provided a link where some of the details
can be found. You could research it yourself if you wanted more detail
than that.
As long as you continue to believe that this is a defect in .NET rather
than a feature, you will make poor progress in achieving your goals. You
need to understand the API you're using if you expect to use it
effectively.
So I take your advice and have some look of the link you have. It appears
that - is assigned some random value that we do not really know and that this
"feature" (might be useful in some cases) considered great in all the case by
some there is thus forced on us now such that we have no choice but to accept
it. Is there something wrong here? Thanks for that.
G.
Pete.
- Follow-Ups:
- Re: How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- From: Peter Duniho
- Re: How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- References:
- How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- From: George Fang
- Re: How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- From: Peter Duniho
- Re: How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- From: G.
- Re: How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- From: Rich P
- Re: How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- From: G.
- Re: How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- From: Rich P
- Re: How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- From: G.
- Re: How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- From: Peter Duniho
- Re: How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- From: G.
- Re: How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- From: Peter Duniho
- How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- Prev by Date: Re: Encode file with 'UCS-2 Little Endian'
- Next by Date: Re: How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- Previous by thread: Re: How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- Next by thread: Re: How can this be? Why in c# "a-0".CompareTo("a0") returns 1?
- Index(es):
Relevant Pages
|