You cannot... all you can do is release all references to it and hope the
garbage collector will delete it as soon as possible. You can force a
garbage collect, but even then it's not guaranteed to delete it.
If you're concerned because the object holds on to resources and you want
them freed ASAP, then use the Dispose pattern. Have the object implement
IDisposable, having the Dispose method free the resources, and invoke
Dispose manually when you are done with the object.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.