This commit was manufactured by cvs2svn to create branch 'mono-1-0'.
[mono.git] / mcs / gmcs / support.cs
index 0cefa1336e6ca7c5e42378deda0bfc363b9b0791..5f9dc55b7662ce8add873fed3e6581ca15cce9c8 100755 (executable)
@@ -405,6 +405,29 @@ namespace Mono.CSharp {
                }
        }                       
 
+       //
+       // Compares member infos based on their name and
+       // also allows one argument to be a string
+       //
+       class MemberInfoCompare : IComparer {
+
+               public int Compare (object a, object b)
+               {
+                       if (a == null || b == null){
+                               Console.WriteLine ("Invalid information passed");
+                               throw new Exception ();
+                       }
+                       
+                       if (a is string)
+                               return String.Compare ((string) a, ((MemberInfo)b).Name, false, CultureInfo.InvariantCulture);
+
+                       if (b is string)
+                               return String.Compare (((MemberInfo)a).Name, (string) b, false, CultureInfo.InvariantCulture);
+
+                       return String.Compare (((MemberInfo)a).Name, ((MemberInfo)b).Name, false, CultureInfo.InvariantCulture);
+               }
+       }
+
        struct Pair {
                public object First;
                public object Second;