Monday, May 24, 2010

How do I delete an object in c#?

I have an object I made myself, and there are many references pointing to it, for example a b and c.





if I do c = null; then it sets the reference c to be null, but objects a and b still point to the object. I want to completely destroy the object, so that a b and c both become null and the object is gone forever.





How do I do this?

How do I delete an object in c#?
Some objects have a DISPOSE method, which is supposed to free up all the resources it uses. Don't know if the simple data types have this method, though. It might be a method of the base OBJECT class which everything else inherits from. Not sure.


No comments:

Post a Comment