Dictionary<TKey, TValue>
At the top of our library we have a base abstract class, we'll call ParentClass. In ParentClass, there is a Name property. Inside the ParentClass is also the Dictionary:
Dictionary<string, ParentClass> dict = new Dictionary<string, ParentClass>;
The Dictionary is private, and we have our own Add method that goes into the Dictionary and adds the new object as the value, and uses the name as the Key:
dict.Add(obj.Name, obj);
obj being an object of a class derived from ParentClass.
My question is this. Is it common practice to use something like a name as a key value I guess my confusion lies in thinking of a key as the same thing as a primary key in a database, which in most all cases you would never use a name as a primary key. However, we want all of the names to be unique in our system. In a database, the primary key really should never change, however, in our system the names must be able to change, which when using Dictionaries, sure the name of the Value (ParentClass object) itself can change, but the associated Key (which is the name of that ParentClass object) of that particular item will not be changed, which creates a problem.
That said, I do not want to double post because my topic here is getting too closely related to my other thread:
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=858399&SiteID=1
Please somebody help clear up my confusion

proper use of a TKey in a Dictionary
xxfredxx
I don't see why dict.Add(obj.Name, obj) would be wrong As long as name is unique, it's perfectly valid.
And I've never seen a rule (or best practise) anywhere that says the key of a dictionary has to be a database primary key. It's just a data structure... which may or may not contain database related objects.
deGame
Xancholy
Rohitkumarvyas
Since I have to be able to change my dictionary keys, is it more appropriate to develop my own collection inheriting from:
System.Collections.ObjectModel.KeyedCollection<TKey, TItem>
Or is there a better way