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 1115777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T03:12:23+00:00 2026-05-17T03:12:23+00:00

In my OrderedDictionary I want to replace an object. I saw that the OrderedDictionary

  • 0

In my OrderedDictionary I want to replace an object. I saw that the OrderedDictionary has a method called Insert(). So, I thought when I get the index of the object I want to replace, I remove that object with RemoveAt() and then insert the new object with the Insert() method.

But… I need to figure out what the index is of the object I want to replace. Should I simply use a for loop or is there a better way?

Some background information: This piece of code is put into a method. And the method can be called multiple times in a for loop in another method.

  • 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-17T03:12:23+00:00Added an answer on May 17, 2026 at 3:12 am

    If you know the key of the target entry you can do it like this:

    myOrderedDictionary["keyToReplace"] = "modifiedValue";
    

    Otherwise, you will have to loop to locate the target before replacing it.

    If you only have the target object in hand you can gets its index by looping through the Values field, but be aware that it’s legal for there to be duplicates here (though not in Keys).

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

Sidebar

Related Questions

Basically I am using some open source code called OrderedDictionary that is derived from
How do I get the key and value of item from OrderedDictionary by index?
No one said that OrderedDictionary is having two copies of elements, one in a
I am considering of using the OrderedDictionary. As a key I want to use
There doesn't appear to be a generic implementation of OrderedDictionary (which is in the
Python has an ordered dictionary . What about an ordered set?
I need a collection data-structure that can do the following: Be sorted Allow me
Is there an collection in .net that allows the storing KeyValuePair<string, string> that keeps
I recently came across some Java code that simply put some strings into a
I am in need of a Generic collection that is somewhere in between a

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.