The key is a mechanism that allows you to later find data ("value").
For example, if you did
information.Add("Kris", "Vandermotten");
you can find Vandermotten later if you know Chris.
Now in this context, what does it mean to change Chris? You put the data under the name "Chris" and want to return it in search of "Bob"? You will not find it.
In a sense, dictionary-dictionary is very similar to primary keys in a relational database. Pay attention to the logical identification of the value. Therefore, firstly, they must uniquely identify it.
So perhaps this example does not make sense. Maybe something like
information.Add(42, new Person("Kris", "Vandermotten")
makes more sense. Then the question, of course, is: what is 42? Sometimes there is a natural candidate for such a key as an employee number or something else, sometimes not.
When not there, maybe you need to do
List<Person> information = new List<Person>(); information.Add(new Person("Kris", "Vandermotten"));
And of course, if the Person object allows you to change the property of the first name and what you want to do, then do it. But "changing dictionary keys" does not make much sense to me.
source share