Article View: be.comp.programming
Article #671Re: [VB.NET] worden objecten gesloten (resources vrijgegeven) na exception ?
From: Stefan Arentz
Date: Thu, 07 Sep 2006 06:43
Date: Thu, 07 Sep 2006 06:43
39 lines
2798 bytes
2798 bytes
Stefan Arentz <stefan.arentz@gmail.com> writes: > John Bokma <john@castleamber.com> writes: > > > "Dr.Ruud" <rvtol+news@isolution.nl> wrote: > > > > > Ik kan me nog steeds niet voorstellen dat de Close niet al automatisch > > > gebeurt, en wel direct bij het out-of-scope raken van xmlrdr. > > > > Als ik mij het heeeel goed herinner is dat bij Java *niet* het geval. > > Dat klopt. Finalizers zijn onvoorspelbaar en implementatie > afhankelijk. Voor de duidelijkheid: een finalizer is dus niet een finally block maar een finalize() methode op een object :-) En: http://msdn.microsoft.com/msdnmag/issues/1100/gci/ To get a resource to clean up properly, the developer must write code that knows how to properly clean up a resource. In the .NET Framework, the developer writes this code in a Close, Dispose, or Finalize method, which I'll describe later. However, as you'll see later, the garbage collector can determine when to call this method automatically. Also, many types represent resources that do not require any cleanup. For example, a Rectangle resource can be completely cleaned up simply by destroying the left, right, width, and height fields maintained in the type's memory. On the other hand, a type that represents a file resource or a network connection resource will require the execution of some explicit clean up code when the resource is to be destroyed. Zelfde idee als in Java dus. En het was toch VB.NET waar de OP mee bezig was? S.
Technical Details
Message-ID:
<87lkow18im.fsf@kip.sateh.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.germany.com!multikabel.net!feed20.multikabel.net!news2.euro.net!transit.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mailReferences:
<1157379669.503669.211910@i42g2000cwa.googlegroups.com> <1157441721.895658.4750@i42g2000cwa.googlegroups.com> <44fd3121$0$21131$dbd41001@news.wanadoo.nl> <44fe77c3$0$1296$6c56d894@reader0.news.be.easynet.net> <44fe89c9$0$71631$dbd43001@news.wanadoo.nl> <edmi5f.11g.1@news.isolution.nl> <Xns98368EAF82335castleamber@130.133.1.4> <87pse818ra.fsf@kip.sateh.com>Show Full Headers
Complete Article Headers
X-Google-Thread: fcea4,7165765ea9e31236 X-Google-Thread: 107324,7165765ea9e31236 X-Google-Attributes: gidfcea4,gid107324,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.germany.com!multikabel.net!feed20.multikabel.net!news2.euro.net!transit.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Sender: stefan@kip.sateh.com Newsgroups: be.comp.programming,nl.comp.programmeren Subject: Re: [VB.NET] worden objecten gesloten (resources vrijgegeven) na exception ? References: <1157379669.503669.211910@i42g2000cwa.googlegroups.com> <1157441721.895658.4750@i42g2000cwa.googlegroups.com> <44fd3121$0$21131$dbd41001@news.wanadoo.nl> <44fe77c3$0$1296$6c56d894@reader0.news.be.easynet.net> <44fe89c9$0$71631$dbd43001@news.wanadoo.nl> <edmi5f.11g.1@news.isolution.nl> <Xns98368EAF82335castleamber@130.133.1.4> <87pse818ra.fsf@kip.sateh.com> From: Stefan Arentz <stefan.arentz@gmail.com> Date: 07 Sep 2006 08:43:45 +0200 Message-ID: <87lkow18im.fsf@kip.sateh.com> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Lines: 39 NNTP-Posting-Host: 82.94.255.227 X-Trace: 1157611827 news.xs4all.nl 4517 [::ffff:82.94.255.227]:4070 X-Complaints-To: abuse@xs4all.nl