Jeroen L.
Jeroen L.

Reputation: 11

c# deep copy of 2 dimensional array of objects

EDIT: because it was marked as duplicate I searched a little further and found this link. So I made a Clone class and cloned each object separately and put it in my new array.

I have a 2 dimensional array of objects of which I would like to have a deep copy. So that when I use the original elements the copied don't change and vice versa.

Only answers I found consisted of 1 dimensional arrays or ints (which aren't self made objects).

A[,] Table = new A[5,5];
B[,] Copy = A; //this just contains references to A

Upvotes: 1

Views: 416

Answers (0)

Related Questions