Showing posts with label const and static readonly. Show all posts
Showing posts with label const and static readonly. Show all posts

Sunday, April 1, 2012

What is the difference between const and static readonly?

The difference is that the value of a readonly field is set at run time, so it can have a different value for different executions of the program. However, the value of a const field is set to a compile time constant.

 

 

Readonly instance fields

  • Must have set value, by the time constructor exits
  • Are evaluated when instance is created

Live

Your Ad Here