In this article, I will explain three basic terms
- Call Stack
- Call Site
- Stack Unwinding
You can also follow my blog
Let us say, you got the below
static void Main(string args)
static void Method1()
static void Method2()
static void Method3()
static void Method4()
static void Method5()
have just created five dummy methods and calling them in nested manner. The
methods, I have created are Method1 to Method5. If you run the above program,
you will get output as below
you examine the output, Methods are being called in reverse
Program is putting the methods in stack as
is Call Stack?
Here, we are calling a method inside a method and
so on and this is called CALL STACK.
Stack is the process of calling method inside a method.
Mathematically, we can say What
is Stack Unwinding?
Once the method call is completed that
method is removed from the stack and this process is known as Stack
is Call Site?
In above program, we are calling Method3 from
Method2, so we can say Method2 is call site of Method3