Author: juraj
Date: 2007-07-19 12:18:05 -0400 (Thu, 19 Jul 2007)
New Revision: 82298

Modified:
   trunk/mcs/class/corlib/System.Collections/ArrayList.cs
   trunk/mcs/class/corlib/System.Collections/ChangeLog
Log:
2007-07-19  Juraj Skripsky  <[EMAIL PROTECTED]>

        * ArrayList.cs (ArrayList.Adapter): If the given list already is an
        ArrayList, just return it directly.



Modified: trunk/mcs/class/corlib/System.Collections/ArrayList.cs
===================================================================
--- trunk/mcs/class/corlib/System.Collections/ArrayList.cs      2007-07-19 
16:14:28 UTC (rev 82297)
+++ trunk/mcs/class/corlib/System.Collections/ArrayList.cs      2007-07-19 
16:18:05 UTC (rev 82298)
@@ -3251,14 +3251,16 @@
                                throw new ArgumentNullException("list");
                        }
 
-                       if (list.IsSynchronized) 
-                       {
-                               return ArrayList.Synchronized(new 
ArrayListAdapter(list));
-                       }
+                       ArrayList arrayList = list as ArrayList;
+                       if (arrayList != null)
+                               return arrayList;
+                       else
+                               arrayList = new ArrayListAdapter(list);
+
+                       if (list.IsSynchronized)
+                               return ArrayList.Synchronized(arrayList);
                        else 
-                       {
-                               return new ArrayListAdapter(list);
-                       }
+                               return arrayList;
                }
 
                public static ArrayList Synchronized(ArrayList arrayList) 

Modified: trunk/mcs/class/corlib/System.Collections/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Collections/ChangeLog 2007-07-19 16:14:28 UTC 
(rev 82297)
+++ trunk/mcs/class/corlib/System.Collections/ChangeLog 2007-07-19 16:18:05 UTC 
(rev 82298)
@@ -1,3 +1,8 @@
+2007-07-19  Juraj Skripsky  <[EMAIL PROTECTED]>
+
+       * ArrayList.cs (ArrayList.Adapter): If the given list already is an
+       ArrayList, just return it directly.
+
 2007-07-05  Gert Driesen  <[EMAIL PROTECTED]>
 
        * CaseInsensitiveHashCodeProvider.cs: Lazy init Default instance and

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to