I *always* implement IDisposable even if I am not using unmanaged resources
up any managed or unmanaged (if any) resources.
"Ilya Tumanov [MS]" wrote:
> There are no destructors, there are finalizers (as your code shows). The
> difference is what destructor in C++ is always called before class is
> destroyed and finalizers might never be called and even if they are called
> you can never predict when that would happened. That is why you have to call
> (or implement) Dispose() instead of using finalizers.
>
>
>
> If your class uses native resources then you have to implement IDisposable
> interface correctly and call it from finalizer with "false" as argument:
>
>
>
> Protected Overrides Sub Finalize()
> Dispose(false)
>
> End Sub
>
> That argument means "Do NOT touch any managed objects" because they might be
> already collected.
>
>
>
> If you don't use any native resources in your class then you don't need to
> implement IDispossable and you don't need finalizer.
>
>
>
> See this for more info:
>
>
>
>
http://weblogs.asp.net/cnagel/archive/2005/01/23/359037.aspx >
>
>
> --
> Best regards,
>
>
>
> Ilya
>
>
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>
> *** Want to find answers instantly? Here's how... ***
>
> 1. Go to
>
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en > 2. Type your question in the text box near "Search this group" button.
> 3. Hit "Search this group" button.
> 4. Read answer(s).
>
> "Mobileboy36" <Mobileboy36@gmail.com> wrote in message
> news:46e7e3d5$0$13862$ba620e4c@news.skynet.be...
> > Public sub New()
> >
> >
> >
> > End sub
> >
> >
> >
> > How to write a destructor in VB.NET?
> >
> >
> >
> > Protected Overrides Sub Finalize()
> >
> > ???
> >
> > End Sub
> >
> >
> >
> >
> >
> > Why you have to call class.dispose than in some cases.
> >
> > When I implement Finialize, do I have to implement Dispose too?
> >
> >
> >
> >
> >
> >
> >
> >
>
>