Members are not ordered by collection kind.
authorAtsushi Eno <atsushi@ximian.com>
Thu, 2 Dec 2010 18:16:45 +0000 (03:16 +0900)
committerAtsushi Eno <atsushi@ximian.com>
Thu, 2 Dec 2010 18:16:45 +0000 (03:16 +0900)
mcs/class/System.Xaml/System.Xaml/TypeExtensionMethods.cs
mcs/class/System.Xaml/Test/System.Xaml/XamlTypeTest.cs

index 661afc482ae105ad9b1949952480e55e82fd6974..90aac542109a0622649290a41bd669f34e38ea1c 100644 (file)
@@ -234,14 +234,6 @@ namespace System.Xaml
                        if (m2.DeclaringType != null && m2.DeclaringType.ContentProperty == m2)
                                return -1;
 
-                       // compare collection kind
-                       var t1 = m1.Type;
-                       var t2 = m2.Type;
-                       int coll1 = t1.IsDictionary ? 3 : t1.IsCollection ? 2 : t1.IsArray ? 1 : 0;
-                       int coll2 = t2.IsDictionary ? 3 : t2.IsCollection ? 2 : t2.IsArray ? 1 : 0;
-                       if (coll1 != coll2)
-                               return coll2 - coll1;
-
                        // then, compare names.
                        return String.CompareOrdinal (m1.Name, m2.Name);
                }
index 8f8d57815408cb79705d4e8ee9dfc179bcc6db26..098d18255a7b19dad5c2b08c2c5812ca884ffb7c 100755 (executable)
@@ -719,6 +719,18 @@ namespace MonoTests.System.Xaml
                        Assert.AreEqual (xm, xt.ContentProperty, "#1");
                        Assert.IsTrue (xt.GetAllMembers ().Contains (xm), "#2");
                }
+               
+               [Test]
+               public void NamedItem ()
+               {
+                       var xt = new XamlType (typeof (NamedItem), sctx);
+                       var e = xt.GetAllMembers ().GetEnumerator ();
+                       Assert.IsTrue (e.MoveNext (), "#1");
+                       Assert.AreEqual (xt.GetMember ("ItemName"), e.Current, "#2");
+                       Assert.IsTrue (e.MoveNext (), "#3");
+                       Assert.AreEqual (xt.GetMember ("References"), e.Current, "#4");
+                       Assert.IsFalse (e.MoveNext (), "#5");
+               }
 
                [Test]
                public void CanAssignTo ()