Hello,
ArrayList is a dynamic array. You should add elements to it by using its
Add method. There are two properties that you can check to get its size:
.Count and .Capacity. The capacity will always be equal to or higher than
the count. You could think of it as similar to a vector class. If you want
to trim it so that the capacity is the count, you can call its TrimToSize()
method.
I hope that helped.
--------------------
From: Mattias Sjögren <ma********************@mvps.org>
Subject: Re: Dynamic arrays
Date: Wed, 30 Jul 2003 01:31:02 +0200
References: <#4**************@tk2msftngp13.phx.gbl>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Message-ID: <eg**************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.csharp
NNTP-Posting-Host: g150.ryd.student.liu.se 130.236.238.150
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:172823
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
Any ideas ?
Allocate a new, larger array, copy over the existing elements, and
drop the reference to the old array. That's what ReDim does, and I'm
guessing that the ArrayList does something similar.
Mattias
--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.