Change 'static readonly' fields to 'const', where appropriate #662
Labels
good-first-issue
Good for newcomers
hacktoberfest-accepted
is:enhancement
New feature or request
pri:normal
up-for-grabs
This issue is open to be worked on by anyone
Milestone
For private fields that are either primitive type or string, we can simply change these to const with no ill effects (which can be its own PR).
For internal/public/protected fields, generally the answer is yes, we should change these. However, changing to const means compiling the value into a consuming assemblies' metadata, so we need to be judicious on how to deal with these.
const
.static readonly
.For example, we need to consider the implications of what will happen if someone uses an older version of one of the modules, such as
Lucene.Net.Analysis.Common
with a newer version ofLucene.Net
that has updates to these constant values. If there is any doubt, these should bestatic readonly
.Do note that making this change may result in compile errors which means we need to either revert the change or apply a fix, if appropriate.
The text was updated successfully, but these errors were encountered: