PC Review


Reply
Thread Tools Rate Thread

choice bw array and arraylist

 
 
=?Utf-8?B?bmFmcmk=?=
Guest
Posts: n/a
 
      19th Nov 2004
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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?YWxhc3Bpbg==?=
Guest
Posts: n/a
 
      19th Nov 2004
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

"nafri" wrote:

> 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
>

 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      19th Nov 2004
"nafri" <(E-Mail Removed)> schrieb:
>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>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ArrayList's Array? Jia Lu Microsoft C# .NET 1 15th Apr 2009 04:10 AM
Array or ArrayList Sam Microsoft VB .NET 18 2nd Dec 2005 03:19 PM
Array not ArrayList John Sutor Microsoft C# .NET 1 6th Apr 2005 12:59 PM
Array vs. ArrayList Bob Rundle Microsoft Dot NET Framework 20 26th Nov 2004 07:23 PM
Array to ArrayList Jerry S Microsoft C# .NET 4 1st Nov 2003 03:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:22 AM.