🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.delphi
Article #346927

Re: Funkcja z parametrem typu TObjectList<T>.

#346927
From: Roman Tyczka
Date: Thu, 14 Feb 2019 11:39
20 lines
1450 bytes
On Thu, 14 Feb 2019 12:10:50 +0100, Marcin G. wrote:

> Jak zrobić w Delphi XE coś takiego:
> function AddObjectList(AGenericObjectList: TObjectList<T>): Boolean;
> 
> zrobiłem tak:
> function AddObjectList(AGenericObjectList: TObjectList<TObject>): Boolean;
> 
> ale nie podoba mi się, że muszę rzutować moją listę obiektów na 
> TObjectList<TObject>
> Po prostu funkcja powinna przyjmować jako parametr listę obiektów dowolnego 
> typu.

Po co do tego generyki? Nie możesz po prostu użyć samego TObjectList?

function AddObjectList(AGenericObjectList: TObjectList): Boolean;

-- 
pozdrawiam
Roman Tyczka
Technical Details
Message-ID: <4bs1g7phb19i$.dlg@tyczka.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
References: <5c654cbb$0$492$65785112@news.neostrada.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
From: Roman Tyczka <noemail@because.no>
Newsgroups: pl.comp.lang.delphi
Subject: Re: Funkcja z parametrem typu TObjectList<T>.
Date: Thu, 14 Feb 2019 12:39:43 +0100
Organization: ATMAN - ATM S.A.
Lines: 20
Sender: romek@tyczka.no.found
Message-ID: <4bs1g7phb19i$.dlg@tyczka.com>
References: <5c654cbb$0$492$65785112@news.neostrada.pl>
NNTP-Posting-Host: ip-94-75-90-137.wave.com.pl
Mime-Version: 1.0
X-Trace: node1.news.atman.pl 1550144383 23968 94.75.90.137 (14 Feb 2019 11:39:43 GMT)
X-Complaints-To: usenet@atman.pl
NNTP-Posting-Date: Thu, 14 Feb 2019 11:39:43 +0000 (UTC)
User-Agent: 40tude_Dialog/2.0.15.84
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit