Reputation: 81342
Do const fields use less memory than regular variables?
Upvotes: 6
Views: 2824
Reputation:
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.
Upvotes: 4