as we know in C# value types store in stack and reference types store in heap.let's talk about it with more details.
think stack as a set of boxes put one on top of the next.we can only use the top box on the stack.if we need another we have to take off the boxes one by one until find the relevant box.
but heap is not like the stack.we can access to anything in the heap once without moving others from there positions.so in heap we can find what we need quickly.
the stack always maintain it's memory allocations by it self.so if the top element of the stack is no longer used it's thrown out.
But in heap memory deallocation is done through the garbage collector. GC find all objects in the heap that are no longer accessed by the main program and delete them.
Stack
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSRcefWq2z0FVBDD7pRAKE-0DvTiQUoZJ3knZXBg4N9oPInHIZvbt-lgqj_ZGWnwcGfCRisfsdohpz7kycXphdobNEF6wQCjtrVuOHybhMnCpQBk95B8n6_bGCPckZSqGTtF_W5BAnbPEC/s320/stack.png)
Heap
For more Information:
http://www.c-sharpcorner.com/uploadfile/rmcochran/csharp_memory01122006130034pm/csharp_memory.aspx?articleid=9adb0e3c-b3f6-40b5-98b5-413b6d348b91