2007-07-19 Juraj Skripsky <js@hotfeet.ch>
authorJuraj Skripsky <js@hotfeet.ch>
Thu, 19 Jul 2007 16:18:05 +0000 (16:18 -0000)
committerJuraj Skripsky <js@hotfeet.ch>
Thu, 19 Jul 2007 16:18:05 +0000 (16:18 -0000)
* ArrayList.cs (ArrayList.Adapter): If the given list already is an
ArrayList, just return it directly.

svn path=/trunk/mcs/; revision=82298

mcs/class/corlib/System.Collections/ArrayList.cs
mcs/class/corlib/System.Collections/ChangeLog

index 6cdb60f3debbcd9ec6bf175ec27b7001d13f515c..8ea973c3ce32d22a11471d68b5837dcd298ba0de 100644 (file)
@@ -3251,14 +3251,16 @@ namespace System.Collections
                                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) 
index b052bd9ae6e05d7f9d1126dc2a7cfc1186ac9f30..d02ead187f770612af7f6cf2f45af79817017be5 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-19  Juraj Skripsky  <js@hotfeet.ch>
+
+       * ArrayList.cs (ArrayList.Adapter): If the given list already is an
+       ArrayList, just return it directly.
+
 2007-07-05  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * CaseInsensitiveHashCodeProvider.cs: Lazy init Default instance and