[C#] Enum has corresponding value in resx file

Hi @Hjaltesorgenfrei,

As far as I can see, usage of Enum for purpose of querying resource file is a project level design and decision. With build-in disadvantage of possible inconsistency that you’ve described.

From this point of view, I don’t see a way how to determine that

  • Specific Enum is meant to be used as a resource key
  • Specific Resource file is meant to be queried by an Enum
  • How to pair correct Enum (from various namespaces) to correct resource file

Also, as long as you have explicit list of resources and resources available at build time (to be able to trigger the rule), you can easily use ResXFileCodeGenerator and access keys from resource file directly.

For these reasons, I don’t think it would be valuable rule for wide range of projects with precise matching. Best option here would be to develop a custom rule for your project.

2 Likes