Hi yaron!
> I wrote a manage c++ wrapper classes that wraps an unmanaged c++ classes.
> if my unmanaged c++ classes don't used any critical resources , do i still
> need to make my managed c++ wrapper classes to implement IDisposable just
> because they are wrapping an unmanage c++ class ?
If you do not need to free memory or any other stuff, you do not need to
implement IDisposable.
In general you can say: If every method/property in your wrapper class
always instanciate a new unmanaged-class then also frees it, you do not
need an IDisposable...
If you instanciate your unmanaged class only once (for example in the
managed constructor) you should implement IDisposable to free this
instance. I do not suggest to use the finilazier, because then you will
be called from a different thread (if at all) and some unmanaged classes
have some troubles with this...

Signature
Greetings
Jochen
My blog about Win32 and .NET
http://blog.kalmbachnet.de/
yaron - 03 Jul 2005 10:58 GMT
Hi Jochen Kalmbach,
but is this is not the work of the GC to free the memory of my __gc wrapper
classes and the unmanage classes they are holding pointers to ?
Thanks.
> Hi yaron!
>
[quoted text clipped - 15 lines]
> be called from a different thread (if at all) and some unmanaged classes
> have some troubles with this...
Jochen Kalmbach [MVP] - 03 Jul 2005 11:47 GMT
Hi yaron!
> but is this is not the work of the GC to free the memory of my __gc wrapper
> classes and the unmanage classes they are holding pointers to ?
Yes. The GC will call your finilizer if GC think it should. But this
will be done from a different thread... and it also might never called
(for example at some circumstances at shutdown)...
It is better, if you provide IDisposable _and_ implement the
finalizer... so the user can either call Dispose or if the user forgets,
the finalizer will be called.

Signature
Greetings
Jochen
My blog about Win32 and .NET
http://blog.kalmbachnet.de/