Does an ArrayList internally use an Array? Is this an empty array if we use the default constructor (new ArrayList())? Thanks.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes it does. One of the easiest ways to verify this is to look at the source. You can either get your hands on the reference source, or you can simply use .NET Reflector to decompile the .NET DLLs.
Here’s the relevant part of ArrayList, from Reflector:
You shouldn’t rely on this always being the case. It is an implementation detail and could change in future versions of .NET (although it probably won’t). Also for new code you should consider using
List<T>instead ofArrayList.