Tuesday, October 20, 2009

Difference between Constant and Readonly

Constant : The constants are the one whose value remain same at all the time.
it will be used if u want to define something at compile time.

Read only:

if you don't know value at compile time but u can find that at runtime that time u can use readonly ..

Read only are the things which are not to allowed to alter by the user but it can be altered by itself. Readonly is generally use in Constructor of the classes.

Like the path of the application exe is read only. If you copy exe to some other directory the path will change. But still it is read only

No comments:

Post a Comment

 
Locations of visitors to this page