Horje
shallow copy vs deep copy c# Code Example
shallow copy vs deep copy c#
// Shallow Copy
A ob1 = new A();
ob1.a = 10;
A ob2 = new A();
ob2 = ob1;
ob1.a = 5; // <-- If you see value of ob2.a after this line, it will be 5

// Deep Copy
A ob1 = new A();
ob1.a = 10;
A ob2 = new A();
ob2.a = ob1.a;
ob1.a = 5; // <-- If you see value of ob2.a after this line, it will be 10.




Csharp

Related
Where C# Code Example Where C# Code Example
c# regex get matched string Code Example c# regex get matched string Code Example
unity get child gameobject Code Example unity get child gameobject Code Example
convert string to list int c# Code Example convert string to list int c# Code Example
unity cast int to float Code Example unity cast int to float Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
12