|
-
August 17th, 2005, 07:13 AM
#7
Re: Array inside a collection
Hi Wizbang,
Basically, using a class and a UDT array eliminates the need for a collection object. Having a collection of class objects would use far more resources from what I can see.
AFAIK you're absolutely correct.
But to be honest, nowadays I just do not consider the need to check the resources having a high priority.
IMHO it is just a matter of concept,
but one thing AFAIK is clear: as in VB you cannot return an array that is not of type variant from a function, you can not create methods in classes that return parts of the current array due to given criteria.
So lets assume you have an instance of a class that is filled, and has an array for the contacts as you described, with 50 elements.
You now want to get all contacts from that array that work in Frankfurt, Germany.
You now have to add methods to the company class to pass the criteria, enhance the property get of the contacts etc etc
With a collection class you just add an enum that contains the the fields that you want to filter, and a method that additionally passes the value like this:
set cColContacts = cCompany.getContacts(enPhone, "004960") ' enPhone is just a enum value, 004960 the number to reach Frankfurt from outside Germany.
IMHO this is a distinct advantage, but as I said, it's just a matter of taste ...
have a nice day
Patzer
_____________________________
Philo will never be forgotten
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|