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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:11:38+00:00 2026-06-05T16:11:38+00:00

I am very new to dictionaries. Very new meaning that I started using them

  • 0

I am very new to dictionaries. Very new meaning that I started using them about 6 hours ago :p. Anyways, I want to know if there is a way to change the key of a dictionary.

Here is my dictionary:

Dictionary<string, string> Information = new Dictionary<string, string>();

Here is how I am adding to the dictionary (this is fired every time the user enters info and hits a button:

Information.Add(txtObjectNumber.Text, addressCombined);

The user needs to be able to edit both fields as well as remove the whole record.

So pretty much the application needs to add txtNumber and txtComments where txtNumber = txtObjectNumber

Thank you for your help.

  • 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-06-05T16:11:39+00:00Added an answer on June 5, 2026 at 4:11 pm

    The key is the mechanism that will allow you to find the data (the “value”) later.

    For example, if you did

    information.Add("Kris", "Vandermotten");
    

    you’d be able to find “Vandermotten” back later if you know “Kris”.

    Now in that context, what does it mean to change “Kris”? You put data in under the name “Kris” and want to get it back out searching for “Bob”? You won’t find it.

    In a way, dictionary key’s are very much like primary keys in a relational database. The refer to the logical identity of the value. So for one thing, they should be uniquely identifying it.

    So maybe this example doesn’t make sense. Maybe something like

    information.Add(42, new Person("Kris", "Vandermotten")
    

    makes more sense. The question then of course is: what’s the 42? Sometimes there is a natural candidate for such a key, like an employee number or something, sometimes there isn’t.

    When there is none, maybe you need to do

    List<Person> information = new List<Person>();
    
    information.Add(new Person("Kris", "Vandermotten"));
    

    And of course, if a Person object allows changing the first name property, and that’s what you want to do, then do it. But “changing dictionary keys” doesn’t make a lot of sense to me.

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

Sidebar

Related Questions

Very new to FluentNHibernate, but I'm also excited about the area. I've recently started
Very new to HTML/CSS. How should I go about making a navbar that is
Very new to XSL (and XML for that matter), but I need to step
Very new to using Raphael.js I'm looking at the tutorials and I am able
very new to javascript, but any help to get me started would be appreciated.
Very new to this, and I have no idea where to start. I want
I know that for me I first got started following the waterfall method of
Very new to xcode. I am working on with a table that when you
Very new to python, please excuse the noob question: I have a number that
very new to signalR, and have rolled up a very simple app that will

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.