Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Ways to delete an object if references are not known.
I posted this question on another messageboard, which I'll link below as a reference to save me posting space.http://www.csharphelp.com/board/read.html?num=1&id=8373&loc=0&thread=8373
To summarize, I need a way to effectively delete objects, and I am unaware of all references to the object, so I can't just remove the references and let the GC collect it.
Ideally, I'd like to delete the object from memory, so that anything with a reference to it would then have a reference to null instead.
If I can't find a way to do this, I'm going to have to add a boolean field to the base object that represents its existence in my program and have all other developers check that. This in my mind is a hack, and a dangerous one, because it could really screw with things if someone forgot to check.
Thanks for any help,
0 · ·