Author: lluis
Date: 2006-11-22 15:08:51 -0500 (Wed, 22 Nov 2006)
New Revision: 68366
Modified:
trunk/mcs/class/corlib/System/Array.cs
trunk/mcs/class/corlib/System/ChangeLog
Log:
2006-11-22 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* Array.cs: (compare<T>) if a comparer is provided, it has
priority over other comparison methods.
Modified: trunk/mcs/class/corlib/System/Array.cs
===================================================================
--- trunk/mcs/class/corlib/System/Array.cs 2006-11-22 19:43:27 UTC (rev
68365)
+++ trunk/mcs/class/corlib/System/Array.cs 2006-11-22 20:08:51 UTC (rev
68366)
@@ -1659,7 +1659,9 @@
private static int compare<T> (T value1, T value2, IComparer<T>
comparer)
{
- if (value1 == null)
+ if (comparer != null)
+ return comparer.Compare (value1, value2);
+ else if (value1 == null)
return value2 == null ? 0 : -1;
else if (value2 == null)
return 1;
@@ -1667,8 +1669,6 @@
return ((IComparable<T>) value1).CompareTo
(value2);
else if (value1 is IComparable)
return ((IComparable) value1).CompareTo
(value2);
- else if (comparer != null)
- return comparer.Compare (value1, value2);
string msg = Locale.GetText ("No IComparable or
IComparable<T> interface found for type '{0}'.");
throw new InvalidOperationException (String.Format
(msg, typeof (T)));
Modified: trunk/mcs/class/corlib/System/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System/ChangeLog 2006-11-22 19:43:27 UTC (rev
68365)
+++ trunk/mcs/class/corlib/System/ChangeLog 2006-11-22 20:08:51 UTC (rev
68366)
@@ -1,3 +1,8 @@
+2006-11-22 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * Array.cs: (compare<T>) if a comparer is provided, it has
+ priority over other comparison methods.
+
2006-11-14 Miguel de Icaza <[EMAIL PROTECTED]>
* Array.cs: TODOs will from now on be used to flag information
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches