Memory Structure Shallow and Deep Copy in .Net 5

“One of the keys to happiness is a bad memory.”
Rita Mae Brown

int a;
{ int a=5; } { int b=7; }
int i= 10
Byte b= (byte)i => 00000000 00000000 00000000 00001010
int i= 255
Byte b= (byte)i => 00000000 00000000 00000000 11111111
int i= 256
Byte b= (byte)i => 00000000 00000000 00000001 00000000

“We do not remember days; we remember moments.“ ―Cesare Pavese

Strange Story of UnBoxing:

Object a = 1923;
int b = (int)a;
  • Firstly we create, Customer Ali and set all his properties. Include HomeAddress.
  • Secondly, we create Customer Veli by cloning Ali.
  • And finally, we change some properties of Veli. “FirstName” and “HomeAddress” properties.

“People change. Memories don’t.”




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Bora Kaşmer

Bora Kaşmer


I have been coding since 1993. I am computer and civil engineer. Microsoft MVP. Senior Software Architect. Ride motorcycle. Gamer. Have two daughters.