Connecting Tech Pros Worldwide Help | Site Map

Whats the point of SortedList.IndexOfKey

 
LinkBack Thread Tools Search this Thread
  #1  
Old February 22nd, 2006, 09:45 PM
john conwell
Guest
 
Posts: n/a
Default 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?

  #2  
Old February 22nd, 2006, 10:05 PM
Mark R. Dawson
Guest
 
Posts: n/a
Default RE: Whats the point of SortedList.IndexOfKey

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:
[color=blue]
> 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?[/color]
  #3  
Old February 22nd, 2006, 10:55 PM
john conwell
Guest
 
Posts: n/a
Default RE: Whats the point of SortedList.IndexOfKey

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:
[color=blue]
> 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:
>[color=green]
> > 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?[/color][/color]
  #4  
Old February 23rd, 2006, 02:15 AM
Mark R. Dawson
Guest
 
Posts: n/a
Default RE: Whats the point of SortedList.IndexOfKey

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:
[color=blue]
> 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:
>[color=green]
> > 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:
> >[color=darkred]
> > > 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?[/color][/color][/color]
  #5  
Old February 23rd, 2006, 02:25 PM
Stoitcho Goutsev \(100\)
Guest
 
Posts: n/a
Default Re: Whats the point of SortedList.IndexOfKey

John,

You have:
GetByIndex to ger value by index and GetKey to get key by index.


--
HTH
Stoitcho Goutsev (100)

"john conwell" <johnconwell@discussions.microsoft.com> wrote in message
news:200C6679-044C-4F1E-95F7-64C9FEE55E69@microsoft.com...[color=blue]
> 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?[/color]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.