A
Andrew Falanga
Hi,
How can I force an objects destructor to execute? I'm writing a WCF
server and client. The server makes a dictionary of objects that are
operated on at the request of the client. I wrote it to be a
dictionary because I saw that the dictionary had a remove method to
remove objects from the dictionary. Now I thought that removing the
object would make it so that there was no more valid reference to the
object and thus garbage collection would come along and dispose of
it. This isn't happening though. I remove all elements in my
dictionary and the objects desctructors are not called. The one way I
know this is that each object makes a temporary file for processing
data and should delete this temp file when the destructor is called.
However, these temp files hang out until the WCF server reaches the
obj.Close() method call.
So, how does one force a call to a destructor?
Andy
How can I force an objects destructor to execute? I'm writing a WCF
server and client. The server makes a dictionary of objects that are
operated on at the request of the client. I wrote it to be a
dictionary because I saw that the dictionary had a remove method to
remove objects from the dictionary. Now I thought that removing the
object would make it so that there was no more valid reference to the
object and thus garbage collection would come along and dispose of
it. This isn't happening though. I remove all elements in my
dictionary and the objects desctructors are not called. The one way I
know this is that each object makes a temporary file for processing
data and should delete this temp file when the destructor is called.
However, these temp files hang out until the WCF server reaches the
obj.Close() method call.
So, how does one force a call to a destructor?
Andy