This rule looks for InitOnly fields (readonly in C#) that could be
turned into Literal (const in C#) because their value is known at
compile time. Literal fields don't need to be initialized (i.e. they don't
force the compiler to add a static constructor to the type) resulting in less code and the
value (not a reference to the field) will be directly used in the IL (which is OK
if the field has internal visibility, but is often problematic if the field is visible outside
the assembly).
See Also:
PreferLiteralOverInitOnlyFieldsRule Members
Syntax
Remarks
Example
Example
Requirements
Namespace: Gendarme.Rules.Performance
Assembly: Gendarme.Rules.Performance (in Gendarme.Rules.Performance.dll)
Assembly Versions: 2.8.0.0