Article View: borland.public.csharpbuilder.language.csharp
Article #320Re: Sharing object with notification on deletion, "best practice" ?
From: OD
Date: Wed, 27 Jul 2005 18:37
Date: Wed, 27 Jul 2005 18:37
21 lines
3024 bytes
3024 bytes
Craig Stuntz [TeamB] a οΏ½crit : > The real difference there is who is responsible. With the IDisposable > method it is up to whoever allocated the instance to Dispose of it. > > With WeakReference, OTOH, you can have a reference to an instance that > doesn't prevent it (the instance you have a refernce to) from getting > GCed, and you can test the reference to see if it's still valid before > using it. thanks. WeakReference seems to be a good technic. But the instance has to be tested before to be used. If it is a reference within a collection and if this collection is a property (or equivalent), that means there must be a getter that can test the reference and suppress it. A bit complex perhaps. But it's something interesting. I have to write a little sample project to see it "at work".. -- Olivier Dahan MK Query Builder www.e-naxos.com
Technical Details
Message-ID:
<mn.dcd57d5750b6d39b.18651@0e-naxos.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<mn.cca47d57c87d5b9d.18651@0e-naxos.com> <42e526b1$1@newsgroups.borland.com> <mn.d03c7d57b10064e4.18651@0e-naxos.com> <42e623d2$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,342976a6aefaf8ae X-Google-Attributes: gid1efe35,public X-Google-Language: ENGLISH,ASCII Subject: Re: Sharing object with notification on deletion, "best practice" ? From: "OD" <OD[.@.]e-naxos.com> References: <mn.cca47d57c87d5b9d.18651@0e-naxos.com> <42e526b1$1@newsgroups.borland.com> <mn.d03c7d57b10064e4.18651@0e-naxos.com> <42e623d2$1@newsgroups.borland.com> Newsgroups: borland.public.csharpbuilder.language.csharp Message-ID: <mn.dcd57d5750b6d39b.18651@0e-naxos.com> Organization: www.e-naxos.com X-Newsreader: MesNews/1.04.00.00 Date: Wed, 27 Jul 2005 20:37:54 +0200 MIME-Version: 1.0 Face: iVBORw0KGgoAAAANSUhEUgAAAC4AAAApBAMAAAHPlTYqAAAAB3RJTUUH0wwfAAI7FsnlTwAAA AlwSFlzAAALEgAACxIB0t1+/AAAAARnQU1BAACxjwv8YQUAAAAVUExURczMzP///5mZmWZmZjNmZpm ZzAAzM6IOup8AAAIwSURBVHjaXVOxkuMgDBV46eH20hMBqb0W6XeM4toh462vyOT/P+EEzm5uDmeGe Y8nCT0RwA8CrAPoLwLNAeA3AAwaAhD4cYB1IbgywXrRoCcE9ADvBPV4eowSceQSCMwxRR1AgdfeA5J S9EeUFt4/AYFhGGVb7rJVON3fR9BmnjtiJg/G10Cj1N0ukh1gHaHtb60WIp2dA2spSxJE60DqDNSAt /HxuI8N1Cf4aEDQYeU7IzWg0yFm5htNvYTNcnLb663qxuHse4wsFT8RvtfABXu7GIi8lCXqRcMHgJM LdDA5Z6Ed9evI1cCqHRxtxBVs6EAd+PHg6/AC92uTbXh9gYpHwOXB6w682ZZSbl1WjzpypmGP8Zo5c +jNGf+L47L3Y6o/8InnQKE3Z8+1XgSIi9VD5ItUD91g9YYyTuguS47ox5+2Reh125QApBk0+h3oLNP FZoisEGhSIN1b5bQ4k6k8ee+UyJUVl3Tjc+fRK+X6HMVJcSUT7TxYMJtJvXbPJG+rya0zgZflXqis8 ORr89gdolgmpvFZ/c8vT3744VE5U5/65ELn19R4u0WWgIIp9TTyihu/ih7nOE/blsLO90TKGuZZPuZ ET74FXO3A+yo/eqNlfE7008Ly2FKYSL42ktT4XFIszBdN+M2LXlnctii/BAEphNAmU5srJkYuc2oDk wG+XqjT7TJGCA3/rqS2bb1JXi+T8y9+wAlz8Vpr+Z+K832qbbAp54JCypE48Bf1mYlrJKOvfwAAAAB JRU5ErkJggg== Plugin-EXIF: J'utilise schexif de Chasta (http://www.chasta.com/fr/plugin.htm) Content-Type: text/plain; charset="iso-8859-15"; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 83.193.203.164 X-Trace: newsgroups.borland.com 1122489472 83.193.203.164 (27 Jul 2005 11:37:52 -0700) Lines: 23 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail