C# attribute text from resource file?

前端 未结 9 1229
难免孤独
难免孤独 2020-12-14 06:53

I have an attribute and i want to load text to the attribute from a resource file.

[IntegerValidation(1, 70, ErrorMessage = Data.Messages.Speed)]
private int         


        
9条回答
  •  [愿得一人]
    2020-12-14 07:39

    If you're using .NET 3.5 or newer you can use ErrorMessageResourceName and ErrorMessageResourceType parameters.

    For example [Required(ErrorMessageResourceName ="attribute_name" , ErrorMessageResourceType = typeof(resource_file_type))]

提交回复
热议问题