Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6773645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:41:33+00:00 2026-05-26T15:41:33+00:00

I guess everything is in the title… I know that Dictionary<TKey,TValue> does keep the

  • 0

I guess everything is in the title…

I know that Dictionary<TKey,TValue> does keep the keys in addition order, but only as long as you don’t remove any, and anyway this behavior is not documented and can’t be relied upon (see this question for details).

Basically, what collection should I use if I want an ordered collection of key/value pairs, while keeping an O(1) access time? (List<KeyValuePair<K,V>> isn’t a good option since it would have O(n) access time). I don’t think there is anything like that in the BCL, but I just want to be sure before I roll my own…

Just to make it clear to everyone: I don’t want the keys to be sorted, I just want them to remain in addition order. So SortedList/SortedDictionary are not what I’m looking for…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:41:34+00:00Added an answer on May 26, 2026 at 3:41 pm

    Could you perhaps just keep a List and a Dictionary that allows you to lookup where keys are in the list? That would allow you to get the key/value pairs in order of addition but still maintain O(1) lookup.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that title didn't make sense, Im sorry! Its hard to word what
Duplicate Unable to remove everything else in a folder except FileA I guess that
That title is a mouthful and a bit confusing, but you are still reading
Ok, I guess this is a pretty easy solution question. Everything that is shown
Everything's in the question title I guess... I tried the findmyip kind of site,
My guess is that class variables (class var) are truly global in storage (that
I guess the topic says it. I have tried googling this, but havent gotten
This is a question about best practices i guess but it applies directly to
What possible reasons do you know for the situation, described in the title? Here's
Everything builds and runs in the simulator fine ... but when I attempt to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.