Write a C# statement where both heap and stack memory allocation is required.
MyClass objMyClass= new MyClass();
A pointer called objMyClass is allocated on stack and once the compiler get to know about the new keyword it allocates the meomry on heap. So the object or the variable from stack keep the reference to the heap area.
Read this article on MSDN on "Heap: Pleasures and Pains"
C# Interview Questions and Answers · · · ·