Article View: borland.public.csharpbuilder.language.csharp
Article #319Re: Sharing object with notification on deletion, "best practice" ?
From: Craig Stuntz TeamB
Date: Tue, 26 Jul 2005 11:51
Date: Tue, 26 Jul 2005 11:51
19 lines
2042 bytes
2042 bytes
OD wrote: > Thanks for the clues. I'll look more closely at WaekReference. I know > the IDisposable but I have to see the major differences between both > solution. 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. -- Craig Stuntz [TeamB] � Vertex Systems Corp. � Columbus, OH Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz Useful articles about InterBase development: http://blogs.teamb.com/craigstuntz/category/21.aspx
Technical Details
Message-ID:
<42e623d2$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!meganewsservers.com!feeder2.on.meganewsservers.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<mn.cca47d57c87d5b9d.18651@0e-naxos.com> <42e526b1$1@newsgroups.borland.com> <mn.d03c7d57b10064e4.18651@0e-naxos.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,342976a6aefaf8ae X-Google-Attributes: gid1efe35,public X-Google-Language: ENGLISH,ASCII From: "Craig Stuntz [TeamB]" <craig_stuntz@nospam.please [a.k.a. acm.org]> Subject: Re: Sharing object with notification on deletion, "best practice" ? Newsgroups: borland.public.csharpbuilder.language.csharp References: <mn.cca47d57c87d5b9d.18651@0e-naxos.com> <42e526b1$1@newsgroups.borland.com> <mn.d03c7d57b10064e4.18651@0e-naxos.com> Organization: Vertex Systems Corporation User-Agent: XanaNews/1.17.5.7 X-Face: "huzh55Xi]!ZNni78>a*5+).`SK?<^q2MlHk-C]Z2M9T@\J5ZCB$95Ey+s"XQuhGFA[eutZ:0^AV!Q;t>gE`1-=8d;HZ6~*o1dH<X9\b$!|(}+I'!Xq)@3Op}%0ArW&nf'Qh*EwR MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 24.106.104.204 Message-ID: <42e623d2$1@newsgroups.borland.com> Date: 26 Jul 2005 04:51:46 -0700 X-Trace: newsgroups.borland.com 1122378706 24.106.104.204 (26 Jul 2005 04:51:46 -0700) Lines: 19 X-Authenticated-User: cstuntz Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!meganewsservers.com!feeder2.on.meganewsservers.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail