> The collection seems so much more flexible than dealing with an array.

In VFP it isn't really... Let's see:

Multiple columns: Not supported. You need an object based on EMPTY as a
collection item, then use ADDPROPERTY() to assign values. Or create a class
and add an instance.

Sorting: Only one column supported which has to be the key column. No way
to sort after properties in the item object.

Inserting: Not supported. You can only append at the end.

Pass to array functions in VFP such as APRINTERS(). Not supported. Only
arrays are supported by native functions. A noticeable exception is using a
collection as a recordsource in a list box.

Searching: Not supported. You need to iterate through all objects and
search manually.

Stability: If you forget the FOXOBJECT (aka NOCRASH) clause in a FOR EACH
loop, you are causing a C5 error.

Performance: Collections are several times slower than arrays

Memory usage: Collections need more memory than arrays and cause higher
fragmentation

Persistence: Collections can not be stored to disk with a single command.
An array can be saved.

Of course, there are some pros, too:

- Collections can be used as an associative array which can be accessed by
key name rather than index.
- Collections can be more easily passed around, because they do not require
by reference passing.
- Item properties are more readable than column indexes
- Item can be arbitrary elements and each one can be different.
- Native concept of being empty.

-- 
Christof


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/cal4qjhiemqeauv6degu+aeplkbbr5bssptftmubxojohwty...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to