Re: arraylist copy



April 9, 2005

Thanks for everybody's replies!

Joseph MCAD


"Cor Ligthert" <notmyfirstname@xxxxxxxxx> wrote in message
news:ucqaDTNPFHA.3076@xxxxxxxxxxxxxxxxxxxxxxx
>
> "Joseph
>> Thanks! Then what is the difference between CopyTo and Clone? MSDN
>> mentioned that clone creates a shallow copy and copyto creates a deep
>> copy? Thanks again!
>>
>
> A clone makes a copy of the arraylist. While an array is a reference type,
> are only the references copied. Any change in a shadow will affect on the
> other one as well. Except when it is by instance the removing or adding of
> a reference (row), than they grew apart.
>
> A copyto makes a copy of the values in a one dimensional array. Where when
> it are objects it is in fact again a shadow of course.
>
> A deep copy makes new copy of all the values and creates a new arraylist
> arround those. For that I have never seen a method in Net. You have to do
> it yourself. (In my opinion can that be complicated when it is by instance
> a jagged array).
>
> I hope this gives some idea's
>
> Cor
>


.



Relevant Pages

  • Re: Confused about casting.
    ... each Match and load them into a String[]? ... That's not as convenient as CopyTo, ... pass in against the Match objects in the array - so I would bet you always ... The cast only converts the String reference to an Object reference - it does ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: arraylist copy
    ... Then what is the difference between CopyTo and Clone? ... reference, than they grew apart. ... A deep copy makes new copy of all the values and creates a new arraylist ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Instances effecting each other?
    ... //Please note that if x and y are reference types, you will want to clone ... it will definitely return a reference to a new object. ... So in that case how can i take an instance in an array and create a new ... SceneChair chair2 = new SceneChair; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: MemberwiseClone() doesnt like arrays?
    ... clone *also* contains a field that is a reference to the managed ... shallow clone on an object whose fields are references. ... and manually clone the array ... you have 2 arrays pointing to the same Customer objects, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: arraylist copy
    ... Then what is the difference between CopyTo and Clone? ... >reference, than they grew apart. ... >A copyto makes a copy of the values in a one dimensional array. ...
    (microsoft.public.dotnet.languages.vb)