Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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.
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# datagridview filter 
Csharp :: c# position of character in string 
Csharp :: unity stack overflow error 
Csharp :: unity rate 
Csharp :: swagger skip endpoint .net core 
Csharp :: c# count items in listbox 
Csharp :: c# write line variable 
Csharp :: how to find min of an array in c# 
Csharp :: C# get the last item of the array 
Csharp :: out variable in c# 
Csharp :: C# Bitwise and Bit Shift operator 
Csharp :: unity ik not working 
Csharp :: make winform open first 
Csharp :: forces the user to enter his password before submitting the form asp.net core 
Csharp :: laravel get current url 
Html :: how to use unsplash images in html 
Html :: text-bold bootstrap 
Html :: bootstrap css cdn 
Html :: bootstrap Bootstrap link 
Html :: input type that allows float number 
Html :: bootstrap col-md-5 center 
Html :: html head logo 
Html :: how to link new tab in html button 
Html :: angular dynamic background image 
Html :: justify-content-between bootstrap 4 
Html :: html skype 
Html :: disable autoplay in html iframe 
Html :: event.preventdefault() in angular 
Html :: font myriad pro html 
Html :: in select option how to make one default 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =