在C#中,什么是执行框架(也与此有关我听说过激活框架)。IIRC 它是方法参数所在的插槽,但无法记住所有细节。
谢谢
“执行框架”是解释语言中使用的术语,尤其是 Python。这是与 C# 非常不同的执行模型。最接近的等价物是 C# 方法中的作用域块,即用花括号括起来的代码块。虽然 Python 执行框架也可以扩展到函数体,但现在它相当于 C# 中的堆栈框架。这是激活框架的另一个术语。
C# 编译器识别 C# 中作用域块的本地声明。运行时不会,它只识别在整个方法的生命周期内都处于活动状态的堆栈帧。编译器通过简单地将所有作用域块中所有局部变量的总和声明为激活帧来简单地掩盖差异。这是 Python 解释器无法承受的奢侈品。
I believe you're referring to a stack frame - in which case the answer is not specific to C# or indeed to any particular language, but rather to the platform that your program is executing on. From the Wikipedia article on the Call Stack:
A call stack is composed of stack frames (sometimes called activation records). These are machine dependent data structures containing subroutine state information. Each stack frame corresponds to a call to a subroutine which has not yet terminated with a return.
See also this answer to a previous question for an excellent description of the stack, including stack frames.