开发者

static class allocation

In C# are static classes s开发者_运维技巧tack allocated?

Since they cannot be instantiated, I guess that must the how it is done.


They're stored inside the area of the heap called the High Frequency Heap. You can find more details in this codeproject article. Static Keyword Demystified


My understanding is that static classes are allocated on the heap (using the static constructor, when the type is initialised).

If they were on the stack, you'd run out of stack space very quickly, if you had a lot of static classes kicking around.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜