rjmurillo / EffectiveCSharp.Analyzers

Many of the recommendations in the book Effective C#: 50 Specific Ways to Improve Your C# can be validated by Roslyn-based analyzers and code fixes.
MIT License
2 stars 1 forks source link

Item 2: Prefer readonly to const #26

Closed rjmurillo closed 2 months ago

rjmurillo commented 2 months ago

Related: https://github.com/BillWagner/EffectiveCSharpAnalyzers/issues/2

C# has two different versions of constants: compile-time constants and runtime constants. Compile time constants are slightly faster than runtime constants but far less flexible.