-
-
Notifications
You must be signed in to change notification settings - Fork 24
Description
In some limited scenarios, it might be worth switching to static readonly properties (perhaps backed by the private constant) so that updates to the library providing the ThisAssembly don't require recompiling callers in order to get the updated values (since consts are embedded raw in the callsite at compile-time).
This might not be so common since ThisAssembly is (by default) internal and (mostly?) intended for internal consumption, but making it public via a partial class is definitely an option, which could lead to this unintended side-effect.
Perhaps introduce a new project-level property that the analyzer uses to switch the template used to generate code, like ThisAssemblyUseStaticProperties?
Originally posted by @Cologler in #63
Based on some articles:
- https://stackoverflow.com/questions/755685/static-readonly-vs-const
- https://stackoverflow.com/questions/3190870/const-string-vs-static-readonly-string-in-c-sharp
If any package has not to recompile, we may get the wrong information. For example, if the main process tries to read the version string from a hotfix dll file, it will always read the wrong value.
