Is there way of copying the whole array into another array? (Other than using a For-loop)

前端 未结 6 1344
孤街浪徒
孤街浪徒 2020-12-14 23:40

Is there way of copying the whole array into another array? Other than using a for-loop.

Does the move or copy command work for this? I did try but it had an error:

6条回答
  •  时光取名叫无心
    2020-12-14 23:40

    See article on delphibasics.co.uk

    You can copy an array using Copy method (pass in 0 for the index and Length(Source) as count to copy the full contents).

    Do NOT use Move or CopyMemory for arrays of string/array/interface/etc managed types. Doing so will bypass Delphi's ref-counting mechanics and will result in memory leaks and corrupted data.

提交回复
热议问题