Reference types

Reference types

C# support 2 predefined reference types object and string.Reference types get stored on heap.

In dot net heap is now more managed and is called managed heap

When application creates first reference types memory is allocated for type at base address of managed heap

When application creates next  garbage collector allocates memory for it in address base immediately following first object. As lomg as address base is available the garbage collector continues to allocate space for new object in following manner

 

Int x=100;

String s= hello;