Example of where Dispose is necessary: when using COM+ Object Pooling [1], the client needs to use ServicedComponent.DisposeObject to dispose objects, e.g. to release them to the object pool. The documentation for ServicedComponent.DisposeObject() says: "It is preferable to use the Dispose design pattern rather than DisposeObject"
[1] http://www.oreillynet.com/pub/a/dotnet/excerpt/com_dotnet_ch10/?page=5 > -----Original Message----- > From: Yosi Taguri [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, October 01, 2002 2:51 AM > To: [EMAIL PROTECTED] > Subject: [ADVANCED-DOTNET] Calling Dispose on a serviceComponent > > > this is a quote from the msdn regarding the subject: > "It is recommended to explicitly release COM+ objects and external > resources before the garbage collector frees the object. If > the external > resource is scarce or expensive, better performance can be achieved by > explicitly releasing COM+ resources when they are no longer needed. > Explicit control is provided by the Dispose method." > > > > my question is : > in case I'm not using any non managed resources in my > component , is it > recomended to call dispose after using it(before getting out > of scope)? > > yosi > > You can read messages from the Advanced DOTNET archive, > unsubscribe from Advanced DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. > You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
