Const object takes memory?

  • Thread starter Thread starter Tomer
  • Start date Start date
T

Tomer

Hi,
When I define a const, does it takes memory in run time, or does the
compiler replace the code where I've used the const var, and then compile
the program?

Tomer.
 
The compiler should replace the constant's value in the IL wherever the
const variable is used. Just compile your code with and without the const
keyword and observe the differences in IL using ILDASM

Cheers
Daniel
 
Thanks!

Tomer.


Daniel Moth said:
The compiler should replace the constant's value in the IL wherever the
const variable is used. Just compile your code with and without the const
keyword and observe the differences in IL using ILDASM

Cheers
Daniel
 
Back
Top