Skip to main content
Post Undeleted by casperOne
Mod Converts to Comment
Post Deleted by casperOne
added 65 characters in body
Source Link
Vinko Vrsalovic
  • 337.3k
  • 55
  • 338
  • 374

This explains it. Summary: const must be initialized at declaration time, readonly can be initialized on the constructor (and thus have a different value depending on the constructor used).

EDIT: See Gishu's gotcha above for the subtle difference

This explains it. Summary: const must be initialized at declaration time, readonly can be initialized on the constructor (and thus have a different value depending on the constructor used).

This explains it. Summary: const must be initialized at declaration time, readonly can be initialized on the constructor (and thus have a different value depending on the constructor used).

EDIT: See Gishu's gotcha above for the subtle difference

Source Link
Vinko Vrsalovic
  • 337.3k
  • 55
  • 338
  • 374

This explains it. Summary: const must be initialized at declaration time, readonly can be initialized on the constructor (and thus have a different value depending on the constructor used).