On Sep 29, 2006, at 5:06 PM, John Kubie wrote:

I knew I should have thought about it a bit more. My method will fail if there are multiple objects with identical sort elements; adding a second one to the dictionary will erase the first. Before adding an element you could test the dictionary, but I'm not sure what you'd do then. It may depend on what you want to use the sort for.

For my particular project each object would have a unique id, so your idea would work in this case. But I think I found the proper way of doing it:

Sub Sort(Extends objs() As myCustomClass)
  Dim x() As Integer

  For k As Integer = 0 To UBound(objs)
    If (objs(k) Is Nil) Then
      objs.Remove(k)
    Else
      x.Append(objs(k).SortByValue)
    End If
  Next

  x.SortWith(objs)

End Sub

Basically, you pick a value to sort the array by... in this code snip it is an Integer property called SortByValue. I suppose I could modify it so that it could take different sortBy values, such as by Timestamp, name, etc.

Notice that this is extending an array of myCustomClass.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to