|
-
Nov 14th, 2014, 07:34 AM
#4
Re: How to Sort 2 Dimensional Array with 5 Columns
Sorting single elements? That's "bread and butter" programming.
Sorting pairs of elements? Now you're starting to make things fiddly; which column is which, again?
Sorting lists of elements? IMHO, that's the time to reach for Types or, better still, Classes.
I'm pretty much a Class-convert now (I started off with Types, but got fed up with their limitations).
The big advantages are that
(a) your fields are named, not indexed, and those names are fixed until you re-code the Class.
(b) an array of objects (class instances) is only one-dimensional, no matter how many fields the class has; sorting is "easy" again.
OK, you need to add a few Set keywords around the place because you're working with objects (not their "default properties") but, IMHO, the extra mileage is well worth it.
Tags for this Thread
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
|