I’m keeping a dictionary with open documents and associated settings. I use the DocumentIDs as the dictionary keys.
Unfortunately I’ve noticed that if a document is copied manually or saved using “Save as…” the new file will (of course) keep it’s document id.
This leads to trouble as I end up with the same key for multiple documents if I open both, the original and the copied file.
Unfortunately, the DocumentID property is private. I could probably change it via my new reflection skills. Is there any reason why I should not do this?
I’ve just realized that I can use the document itself as a dictionary key – which goes into the same direction as you propose.
Probably best to not fiddle around too much with Davids stuff
While documents are loaded they remain the same class instances. You could use ReferenceEquals() to check whether any given two GH_Documents are the same instance.