In C # do constant fields use less memory?

Do constant fields use less memory than regular variables?

+5
source share
1 answer

The memory consumption of the Const fields depends on its use. Constant field values ​​are embedded in IL code at compile time. Without a single reference to the const field, there is no memory. When there are many references to a constant field, memory usage can multiply depending on the part of the code that is currently in memory.

+4
source

All Articles