473,320 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Arraylist deep copy

Hi,

I would like to ask if the constructor ArrayList(ICollection c) performs the
deep or shallow copy of "c" collection.

If it perfoms just shallow copy, is there any method for doing a deep one?

Thanks,

Lubomir
Aug 1 '06 #1
2 2709
Lubomir,

It performs a shallow copy. It will not perform a full copy of the
items in the collection when bringing them over.

.NET doesn't really have a mechanism to distinguish between a deep and a
shallow copy operation.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Lubomir" <Lu*****@discussions.microsoft.comwrote in message
news:C4**********************************@microsof t.com...
Hi,

I would like to ask if the constructor ArrayList(ICollection c) performs
the
deep or shallow copy of "c" collection.

If it perfoms just shallow copy, is there any method for doing a deep one?

Thanks,

Lubomir

Aug 1 '06 #2
Hi,

Shallow. IIRC none of the collection classes in the framework does a deep
copy, even if the collected type support ICloneable.

You would have to inherit from the collection you want and implement a deep
copy method. For this the collected class should implement ICloneable

--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Lubomir" <Lu*****@discussions.microsoft.comwrote in message
news:C4**********************************@microsof t.com...
Hi,

I would like to ask if the constructor ArrayList(ICollection c) performs
the
deep or shallow copy of "c" collection.

If it perfoms just shallow copy, is there any method for doing a deep one?

Thanks,

Lubomir

Aug 1 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Marc Lefebvre | last post by:
there is an easy way to make a deep copy of an arraylist ? suppose I have an arraylist of COptions implements ICloneable I have need to overload the Clone() methode of a derived ArrayList...
1
by: Marc Lefebvre | last post by:
there is an easy way to make a deep copy of an arraylist ? suppose I have an arraylist of COptions implements ICloneable I have need to overload the Clone() methode of a derived ArrayList...
1
by: Marc Lefebvre | last post by:
there is an easy way to make a deep copy of an arraylist ? suppose I have an arraylist of COptions implements ICloneable I have need to overload the Clone() methode of a derived ArrayList...
15
by: Sam | last post by:
Hi, I have the following code : Dim rNodeList As New ArrayList Dim rNodeListNew As New ArrayList For iCntr As Integer = 0 To tvRelations.Nodes.Count - 1...
6
by: Desmond Cassidy | last post by:
Hi, I'm sure this has been asked several times before but I'll risk it ;-) If I wish to save an Arraylist to another Arraylist and work on te original without affecting the contents of the new...
8
by: Esmail Bonakdarian | last post by:
Hello, I am relatively new to C# but like it. I have run into a problem to which I haven't been able to find a solution despite looking. I have an ArrayList that contains several...
5
by: tshad | last post by:
How do you easily make a copy of an arraylist? If you do: arrayList2 = arrayList1 You get a pointer so that if you clear arrayList2 (arrayList2.Clear) - arrayList1 is also cleared. I...
22
by: Steven Blair | last post by:
I need to perform a Deep Copy on an ArrayList. I wrote a small sample app to prove this could be done: ArrayList a = new ArrayList(); ArrayList b = new ArrayList(); a.Add("Hello"); b =...
3
by: Christopher H | last post by:
I've been reading about how C# passes ArrayLists as reference and Structs as value, but I still can't get my program to work like I want it to. Simple example: ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.