Board index » delphi » copy TCollectionItem from another TCollectionItem problem

copy TCollectionItem from another TCollectionItem problem

Hi:

I want to copy one CollectionItem property to another CollectionItem(they
both inherited from the same class). Do I have to write own method to copy
one item's data to another?

Thanks

Roland Zhang

 

Re:copy TCollectionItem from another TCollectionItem problem


Quote
In article <3b2465ec_2@dnews>, Roland wrote:
> I want to copy one CollectionItem property to another CollectionItem(they
> both inherited from the same class). Do I have to write own method to copy
> one item's data to another?

Generally, yes. There is no generic method to copy an object that would work
for any class you could come up with. TCollectionitem inherits from
TPersistent, so you could override the Assign method and do the
field-by-field copy there.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.

Re:copy TCollectionItem from another TCollectionItem problem


Thanks Peter.

Roland Zhang

Other Threads