开发者

C# do const fields use less memory?

开发者 https://www.devze.com 2022-12-13 07:37 出处:网络
Do const fields use less memory than regular varia开发者_StackOverflowbles?Const fields memory consumption depends on its usage. The values of const fields are embedded into the IL code during compila

Do const fields use less memory than regular varia开发者_StackOverflowbles?


Const fields memory consumption depends on its usage. The values of const fields are embedded into the IL code during compilation. Without a single reference to a const field there is no memory consumed. When there are many references to the const field, then memory usage may multiply depending on the code portion currently residing in memory.

0

精彩评论

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