ArrayList Type no longer supported in .NET 3.5 upwards?
I imported System.Collections namespace in my class, but I still cant use ArrayList type. The code editor says the "class not found". I am using VS2008 & VS2010.开发者_如何学Python
So has MS stopped support for this type in framworks 3.5 and upwards ?
ArrayList is still supported in .NET 3.5 and .NET 4.0. From MSDN:
ArrayList Class
Implements the IList interface using an array whose size is dynamically increased as required.
Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)...
Version Information
.NET Framework
Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0
Remember that it's not a generic type so you can't write ArrayList<Foo>
. You should use List<T>
instead.
Why don't you use a List instead ?
List<myObject> variable = new List<myObject>();
IIRC they haven't but you should really use List<T>
in System.Collections.Generic.
精彩评论