In the static readonly case, the containing class is allowed to modify it only
- in the variable declaration (through a variable initializer)
- in the static constructor (instance constructors, if it's not static)
static readonly is typically used if the type of the field is not allowed in a const declaration (array of constants), or when the value is not known at compile time.
No comments:
Post a Comment