0

I Want to use resources with various language type for my attribute arguments, such as Description Attribute or Display Attribute. As we know, currently C# raise an error for "An Attribute Argument must be a constant expression.". So, how could we solve this issue and use resource instead of constant expression and for example use English Resource for (English/Left To Right) language and (Persian/Right to Left) Languages?

In fact, I don't want any string in my Source Code, I Just want to define any string in any language in my resources and just use their names in my attribute arguments or any other place in source code.

  • Simply put, that's not possible. Maybe if you describe the problem, people can suggest a different solution instead of compile-time attributes. – nvoigt Jun 15 '20 at 10:47
  • 1
    Check out this similar question: https://stackoverflow.com/questions/2431333/displayname-attribute-from-resources – Ergwun Jun 15 '20 at 10:52
  • @nvoigt that is easily possible with custom attribute and using Ctor, that is just to you know it is possible. but I want better ways – MazMaz Developers Jun 15 '20 at 10:55
  • Sorry, I probably misunderstood what you want to do. Since I still don't know, it's hard to tell. – nvoigt Jun 15 '20 at 11:03

0 Answers0