Skip to content

Allow switching to static readonly properties instead of constants #64

@kzu

Description

@kzu

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:

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.

Back this issue
Back this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions