I’m confused to find whether an object is either copied or the reference of the object is held while equating it to some other objects.
Examples
int i =5;
int j = i;
Reference or copy of data?
DataSet ds = dsOtherDataSet.Copy();
Reference or copy of data?
DataView dvTemp = dsTestDataSet.Copy().DefaultView;
What happens here?
Regards
NLV
Copy of data as int is a value type and is stored on the stack.
According to the documentation the Copy method copies both the structure and data of the DataSet. So ds will have the same structure as the original but if there are reference values stored inside both will point to the same memory location.
Only the reference is copied as
DataViewis a reference type.