In my current understanding, when a function or a method is called, the data related to this method, say MethodA
, is stored inside a stack frame to be kept track of during the execution of this method. And if this method in turn calls another method, say MethodB
, the data related to MethodB
will be stored in another stack frame which will be put on the top of the stack frame of MethodA
.
May I ask, in C#, are those stack frames stored on the stack? Or are they located in a separate place?
If the stack frames are sitting on the stack, and say if in the stack frames there are some data of reference type, may I ask if the value of those data stored in those stack frames are the reference of the object which are pointing to the heap? Or if in such cases the object itself is stored in the stack frame on the stack?
Many thanks!