[Mono-dev] Problem with List<T>.Sort(IComparer<T>)
Atsushi Eno
atsushi at ximian.com
Tue Dec 6 19:33:30 EST 2005
I've already filed it as
http://bugzilla.ximian.com/show_bug.cgi?id=76361
Basically you can query bugs before filing new one (and is highly
recommended). For class libraries, try the type name of the target
class (with the target assembly) if you know. In this case, you
will find this bug when you query "List" in CORLIB.
(Feel free to add cc: to yourself on that bug if you'd like to
keep track of the bug.)
Cheers,
Atsushi Eno
Grant Monroe wrote:
> The following code results in an InvalidCastException rather than an
> InvalidOperationExcepation wrapping the ApplicationException. I didn't
> find any bug explicitly about this, but I just wanted make sure this
> wasn't covered by another bug in bugzilla. If not, I'll go ahead and
> post it.
>
> using System;
> using System.IO;
> using System.Collections.Generic;
>
> public class TestComparer: IComparer<string>
> {
> public int Compare(string x, string y)
> {
> throw new ApplicationException("doesn't even get called");
> }
> }
>
> class Test
> {
> public static void Main(string[] args)
> {
> List<string> l = new List<string>();
> l.Add("b");
> l.Add("a");
> l.Add("c");
> TestComparer sc = new TestComparer();
> l.Sort(sc);
> }
> }
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
More information about the Mono-devel-list
mailing list