Article View: borland.public.csharpbuilder.language.csharp
Article #311Sharing object with notification on deletion, "best practice" ?
From: OD
Date: Mon, 25 Jul 2005 17:48
Date: Mon, 25 Jul 2005 17:48
35 lines
3010 bytes
3010 bytes
Hi all, once again with a problem of modeling under C# more than a syntax problem. here is the problem : Class A is showing a property (or accessors, no matter) for a collection of object of class P. users of class A can add and suppress instances of P Now, I've got a class B that is referencing some instances of P stores in A. Well. Here is the question : what is the best pattern to be sure that when the user is deleting an object from the list stores in A, the object is no more referenced by the instance of class B ? Under Delphi I show a few solutions, by example using a notification scheme. But under .NET and C#, destructors are not often used, object are not freed, they are just "forgotten" and the GC make the job, destructor are not always called, etc. So, what's the best way to notify instance of Class B that a P object stored in A has been deleted ? I'm not sure to be clear... But i'll appreciate all your ideas :-) thanks in advance -- Olivier Dahan MK Query Builder www.e-naxos.com
Technical Details
Message-ID:
<mn.cca47d57c87d5b9d.18651@0e-naxos.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,342976a6aefaf8ae,start X-Google-Attributes: gid1efe35,public X-Google-Language: ENGLISH,ASCII-7-bit Subject: Sharing object with notification on deletion, "best practice" ? From: "OD" <OD[.@.]e-naxos.com> Newsgroups: borland.public.csharpbuilder.language.csharp Message-ID: <mn.cca47d57c87d5b9d.18651@0e-naxos.com> Organization: www.e-naxos.com X-Newsreader: MesNews/1.04.00.00 Date: Mon, 25 Jul 2005 19:48:23 +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; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 83.203.90.134 X-Trace: newsgroups.borland.com 1122313701 83.203.90.134 (25 Jul 2005 10:48:21 -0700) Lines: 37 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail