Implementing IComparable by:Anonymous
|
Does anyone know if it's possible, and if so, how to implement a secondary comparison criteria?
Let's say we've got a collection of Person objects that we want sorted by LastName then by FirstName... How would I construct a CompareTo function to accomplish this?
Thanks in advance!
|
| | Reply: by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])
|
| | \\Dim Result As Integer = x.LastName.CompareTo(y.LastName) If Result = 0 Then Result = x.FirstName.CompareTo(y.FirstName) End If Return Result ///
-- Herfried K. Wagner [MVP]
|
| | Reply: by:Anonymous
|
| | BRILLIANT! Thanks a million!
|
0 Comments:
Post a Comment