🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Indexed properties

#93
From: Murdoc
Date: Fri, 07 Apr 2006 10:01
30 lines
1807 bytes
Nils Haeck wrote:

> > Another 'workaround' commonly used is to make each indexer it's own
> > collection class. Like the Controls property on a form for example.
> 
> Yes I know I can add a collection class. But there are reasons for me to avoid this:
> 
> 1. The source code is then completely different from my Delphi source

That was always a possibility.

> 2. A collection needs to be initialized in its parent object, so it takes up space in all cases,
> even if the collection is empty. In case of a parent object of which there exist a few million,
> this will add up.

So only initialize the collection instance if it is necessary.

Disclaimer: Apologies for the Java code.

E.g. 

public void add(Object o)
{
    if (_collection == null)
        _collection = new Collection();

    _collection.add(o);
}

-- 
Technical Details
Message-ID: <xn0ekpeax9w6l000@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news2.volia.net!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <442dc6a5$1@newsgroups.borland.com> <442e3f8a$1@newsgroups.borland.com> <1gx6nf1imch9z$.dlg@dlg.marcrohloff.com> <44363557$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,8168306bbf9f2550
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Murdoc" <murdoc_0@hotmail.com>
Subject: Re: Indexed properties
Newsgroups: borland.public.csharpbuilder.language.csharp
References: <442dc6a5$1@newsgroups.borland.com> <442e3f8a$1@newsgroups.borland.com> <1gx6nf1imch9z$.dlg@dlg.marcrohloff.com> <44363557$1@newsgroups.borland.com>
User-Agent: XanaNews/1.18.1.2
Message-ID: <xn0ekpeax9w6l000@newsgroups.borland.com>
X-Ref: newsgroups.borland.com ~XNS:00003419
NNTP-Posting-Host: 61.69.137.233
Date: 7 Apr 2006 03:01:54 -0700
X-Trace: newsgroups.borland.com 1144404114 61.69.137.233 (7 Apr 2006 03:01:54 -0700)
Lines: 31
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news2.volia.net!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail