Professional Documents
Culture Documents
Basharat Hussain
14/10/2020
https://www.c-sharpcorner.com/article/C-Sharp-heaping-vs-stacking-in-net-part-i/
Stack
• Think of the Stack as a series of boxes stacked
one on top of the next.
• class
• interface
• delegate
• object
• string
3. Pointers
• A Reference is often referred to as a Pointer.
• We don't explicitly use Pointers, they are managed by the
Common Language Runtime (CLR).
• A Pointer (or Reference) is different than a Reference Type in
that when we say something is a Reference Type is a means
we access it through a Pointer.
• Point #1 - clear
• Point #2 – not clear – let’s explain it.
Method and calling sequence
• Remember stack is sequential.
• During a method call – start executing a method (JIT compiler) –
• Yes
• Rule:
• When we are using Reference Types, we're dealing with Pointers to
the type, not the thing itself.
• When we're using Value Types, we're using the thing itself.
Example 1 – value type
• We'll get the value of x?
• 3 - right
Example 2 – Reference type
• 4 - right
• END