471,318 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,318 software developers and data experts.

Whats the point of SortedList.IndexOfKey

So you pass in the Key and it returns the array index of the key. but you
cant do array index lookups. the indexer of the sortedlist does a binary
search based on the key. So whats the pointof this method? is there a way
to return a array item based on the index?
Feb 22 '06 #1
4 4258
Hi John,
the SortedList type has a GetByIndex method which allows you to enter the
ordinal position of an item in the list and retrieve the value stored at that
position.

Mark Dawson
http://www.markdawson.org
"john conwell" wrote:
So you pass in the Key and it returns the array index of the key. but you
cant do array index lookups. the indexer of the sortedlist does a binary
search based on the key. So whats the pointof this method? is there a way
to return a array item based on the index?

Feb 22 '06 #2
Sorry, i should have been more specific. I'm talking about the 2.0 Generic
SortedList. The 1.1 SortedList does have a GetByIndex. the 2.0 Generic
SortedList does not.

"Mark R. Dawson" wrote:
Hi John,
the SortedList type has a GetByIndex method which allows you to enter the
ordinal position of an item in the list and retrieve the value stored at that
position.

Mark Dawson
http://www.markdawson.org
"john conwell" wrote:
So you pass in the Key and it returns the array index of the key. but you
cant do array index lookups. the indexer of the sortedlist does a binary
search based on the key. So whats the pointof this method? is there a way
to return a array item based on the index?

Feb 22 '06 #3
In the SortedList you have the Values collection which can be referenced by
an ordinal position. I guess you could use your index value with that to
return the desired value.

Mark Dawson
http://www.markdawson.org
"john conwell" wrote:
Sorry, i should have been more specific. I'm talking about the 2.0 Generic
SortedList. The 1.1 SortedList does have a GetByIndex. the 2.0 Generic
SortedList does not.

"Mark R. Dawson" wrote:
Hi John,
the SortedList type has a GetByIndex method which allows you to enter the
ordinal position of an item in the list and retrieve the value stored at that
position.

Mark Dawson
http://www.markdawson.org
"john conwell" wrote:
So you pass in the Key and it returns the array index of the key. but you
cant do array index lookups. the indexer of the sortedlist does a binary
search based on the key. So whats the pointof this method? is there a way
to return a array item based on the index?

Feb 23 '06 #4
John,

You have:
GetByIndex to ger value by index and GetKey to get key by index.
--
HTH
Stoitcho Goutsev (100)

"john conwell" <jo*********@discussions.microsoft.com> wrote in message
news:20**********************************@microsof t.com...
So you pass in the Key and it returns the array index of the key. but you
cant do array index lookups. the indexer of the sortedlist does a binary
search based on the key. So whats the pointof this method? is there a
way
to return a array item based on the index?

Feb 23 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by gerrod | last post: by
2 posts views Thread by Curious | last post: by
2 posts views Thread by newscorrespondent | last post: by
2 posts views Thread by Prez | last post: by
4 posts views Thread by SHEBERT | last post: by
2 posts views Thread by Bruce Arnold | last post: by
2 posts views Thread by Bruce Wood | last post: by
6 posts views Thread by n3tx | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.