I'm trying to wrap my ming around C#/CLR garbage collection. In an
ASP.NET project, I'm having a problem because an object destructor is
being called by another thread, long after my code is done. I'm wanting
to know if I can force it to happen immediately (when the object goes
out of scope) without going back and adding all of the required
Dispose() calls..
public Method()
{
CustomClass o = new CustomClass(..) ;
..
..
..
};
Is there a way to "force" the CustomClass destructor to be called right
when the object goes out of scope, by the same thread as the Method?
Thanks.
ASP.NET project, I'm having a problem because an object destructor is
being called by another thread, long after my code is done. I'm wanting
to know if I can force it to happen immediately (when the object goes
out of scope) without going back and adding all of the required
Dispose() calls..
public Method()
{
CustomClass o = new CustomClass(..) ;
..
..
..
};
Is there a way to "force" the CustomClass destructor to be called right
when the object goes out of scope, by the same thread as the Method?
Thanks.
Comment