choice bw array and arraylist

G

Guest

i am declaring an array of points
dim arrOfPoints as point()
however i want arrofPoints to grow dynamically like in arraylist and use add
method.

I can use dim arrofPoints as Arraylist() but then any object can be added to
the array.

So what is the easiest way to populate arrofPoints with just Point Objects
and at the same time use functionality like add,remove as in ArrayList class.

TIA
Nafri
 
G

Guest

wrap your ArrayList inside another class.
To THAT class add methods which will validate the items you are attempting
to add to make sure they are points.

Alternatively (if you can do this):
Create a class that inherits ArrayList and redefine the Add method with the
validation you require...

HTH
 
H

Herfried K. Wagner [MVP]

nafri said:
i am declaring an array of points
dim arrOfPoints as point()
however i want arrofPoints to grow dynamically like in arraylist and use
add
method.

I can use dim arrofPoints as Arraylist() but then any object can be added
to
the array.

So what is the easiest way to populate arrofPoints with just Point Objects
and at the same time use functionality like add,remove as in ArrayList
class.

<URL:http://www.google.de/groups?&q=dotnet+strongly+typed+collections>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top