The readonly keyword is a modifier that you can use on fields. When a field declaration includes a readonly
modifier, assignments to the fields introduced by the declaration can
only occur as part of the declaration or in a constructor in the same
class. for example:
public readonly int y = 5;
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
for example: