How to localize Range attribute?
问题 So I need to localize this [Range(1, 150, ErrorMessage = "")] I tried to use [Range(1, 150, ErrorMessage = MyApp.Properties.Resource.ErrorMessageMustBeBetween)] where MyApp.Properties.Resource.ErrorMessageMustBeBetween is "{0} must be between {1} and {2}." and it says An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type How it could be done then? Thank you! 回答1: You need to use ErrorMessageResourceType and