Yea that's what I ended up doing. I thought more on what I needed to
do and how I needed to access the data and decided I would just keep
them in arrays. I also needed to keep a second 'key' so I just added
that to the sortwith parameters and everyone is happy.
Thanks.
On Feb 9, 2007, at 9:18 AM, [EMAIL PROTECTED] wrote:
On Feb 09, 2007, at 17:02 UTC, Chris Griffin wrote:
Ouch! Kinda defeats the whole dictionaries are fast thing. I guess I
need to look and see if it would be better to just keep these things
in arrays in the first place. :-(
That may well be the case, if order matters -- an assumption of
Dictionaries is that order doesn't matter.
However, there's nothing magic about the Keys function (nor the Values
function for that matter). It just loops through the dictionary and
gathers them up. You can do the same thing yourself almost as fast. I
have a StringKeys extension method I sometimes use:
Function StringKeys(Extends dict As Dictionary) As String()
Dim i, maxi As Integer
maxi = dict.Count - 1
Dim out() As String
redim out( maxi )
for i = 0 to maxi
out(i) = dict.Key( i )
next
return out
End Function
With that, your function as originally written would work (just use
StringKeys instead of .Keys). However, you're still converting your
dictionary into a pair of arrays; if speed matters, consider just
keeping them as arrays instead.
Best,
- Joe
--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC "Making the Internet a Better Place"
http://www.verex.com/
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>