Diff b/w Const and readonly?

 Posted by Puneet20884 on 1/5/2010 | Category: ASP.NET Interview questions | Views: 3974
Answer:

A const can not be static, while readonly can be static.

A const need to be declared and initialized at declaration only, while a readonly can be initialized at declaration or by the code in the constructor.

A const’s value is evaluated at design time, while a readonly’s value is evaluated at runtime.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response