Tim,
| Purists will say not to use GC.Collect() but in a situation like this I
| wouldn't hesitate if it solves the problem.
I would question if it actually solves the problem or simply *masks* the
problem.
By masking the problem I mean making it appear the problem is solved.
I hope you agree that masking the problem is not really the same as solving
the problem. Although masking the problem sometimes is the only "viable"
solution.
For details on when to call GC.Collect see Rule #1 at:
http://blogs.msdn.com/ricom/archive/...29/271829.aspx
http://blogs.msdn.com/ricom/archive/.../02/40780.aspx
Just remember that "the collector is self-tuning so don't mess with it"!
Hope this helps
Jay
"Tim Anderson" <ti*****@hotmail.com> wrote in message
news:eo*************@TK2MSFTNGP11.phx.gbl...
|
| "Michael Tissington" <mi*****@nospam.com> wrote in message
| news:%2****************@TK2MSFTNGP14.phx.gbl...
| > I'm writing both the .NET object and the COM client.
| >
| > So how does the COM client call Dispose on the .NET Object ?
|
| Just implement iDisposable in the .NET object. Write code for the Dispose
| method that cleans up resources. Then have the COM client call Dispose.
|
| Note this won't actually destroy the object, but it means you can release
| resources.
|
| > Does the .NET object need to impalement Dispose ?
|
| Yes.
|
| > (at the moment I have resorted to GC.Collect() to force this).
|
| Purists will say not to use GC.Collect() but in a situation like this I
| wouldn't hesitate if it solves the problem.
|
| Tim
| Tech blog
|
http://www.itwriting.com/blog/
|
|