D
DaTurk
This is probably a very silly, and simple question. If I'm coding in
CLI, and I want to copy an array to an array, not a deep copy, just
something of the nature arr1 = arr2, what is going on?
I assumed the address of the first element is getting copied, so i
essentially have two handles to the same memory. And changes in one
would be reflected in the other.
But what if I have something like this
public value struct MyStruct
{
Int32 MyNumber;
};
array<MyStruct>^ arr1 = gcnew array<MyStruct(10);
//We fill the array with 10 MyStruct
array<MyStruct>^ arr2 = arr1;
Now what do we have here? since it's a value struct, did we
essentially do a deep copy?
CLI, and I want to copy an array to an array, not a deep copy, just
something of the nature arr1 = arr2, what is going on?
I assumed the address of the first element is getting copied, so i
essentially have two handles to the same memory. And changes in one
would be reflected in the other.
But what if I have something like this
public value struct MyStruct
{
Int32 MyNumber;
};
array<MyStruct>^ arr1 = gcnew array<MyStruct(10);
//We fill the array with 10 MyStruct
array<MyStruct>^ arr2 = arr1;
Now what do we have here? since it's a value struct, did we
essentially do a deep copy?