I'm going mad with value vs reference in relation to dictionaries.
How come when I do this:
Object obj = ObjDictionary[key];
obj.intproperty ++;
C# increments the intproperty of the corresponding object in ObjDictionary as well as obj itself. This suggests to me the operation creates a reference rather than a copy of the Object but I can't find out how to copy the Object itself into a new one.
This is causing all sorts of havoc for me as I try to create new dictionaries from objects copied from the original dictionary.
EDIT:
I understand the dictionary does not contain objects, but references to objects.
The problem I'm still having is how this line works.
Object obj = ObjDictionary[key];
How does it compile when obj is an Object and ObjDictionary[key] is a reference? Is this something C# does implicitly?