🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.language.csharp
Article #660

IDisposable - When?

#660
From: Theo Bebekis
Date: Fri, 17 Sep 2004 10:54
56 lines
2240 bytes
Hi there

Well, after reading the relevant topics the online help provides,
I'm still consfused. When do I have to implement IDisposable?

Please, see the following imaginery scenario.

   public class Room {}

   public class RoomList
   {
    // contains a list of rooms
   }

   public class House
   {
    public RoomList Rooms = new RoomList();
   }

   public class HouseList
   {
    // contains a list of houses
   }

   public class Quarter
   {
    public HouseList Houses = new HouseList();
   }


None of the above classes contains/uses unmanaged resources.
What I want is when a Quarter is disposed all the contained objects disposed.
Do I have to implement IDisposable and where?
Should I stop worrying and let GC do the job, when just managed resources
are involved?

Implementing the above hierarchy in Delphi (<=7) seems so easy to me.
Just a couple of TLists or -better- TObjectLists and done.
Now what?

I have to admit it anyway: I miss TObjectList and TStringList.

-- 
Regards
Theo

PS. God, I love this job. It keeps me young. ( lol )

------------------------
Theo Bebekis
Thessaloniki, Greece
------------------------
Greek_Delphi_Prog
A Delphi Programming mailing list in Greek
http://groups.yahoo.com/group/Greek_Delphi_Prog
------------------------
Technical Details
Message-ID: <414ac1ca@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,b3e8021b863a6f6b,start
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Fri, 17 Sep 2004 13:54:30 +0300
From: Theo Bebekis <teo@thinx.gr>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040803
X-Accept-Language: el, en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.csharpbuilder.language.csharp
Subject: IDisposable - When?
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 83.235.253.166
Message-ID: <414ac1ca@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1095418314 83.235.253.166 (17 Sep 2004 03:51:54 -0700)
Lines: 56
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail