I want to know what is the initial size of ArrayList in C#?
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.
0. See below.16. (I have to add characters to this answer, since 18 characters are minimum)Edit, Oops – the initial capacity is 16. Initial size is of course 0, because it’s empty. Have to learn how to read. Or you have to learn how to form your questions. 😉
Edit again; Initial capacity of an ArrayList in .NET 1.0 is 16. In 2.0 it was 4, and now – with .NET 3.5 – the initial capacty has been lowered to 0. I don’t have an explanation of why, thou.
When adding a first element to the list, the capacity will be set to 4. There after, every time when arraylist.Count eq arraylist.Capacity, the capacity will double.