C# attribute text from resource file?

前端 未结 9 1263
难免孤独
难免孤独 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:36

    Attribute values are hard-coded into the assembly when you compile. If you want to do anything at execution time, you'll need to use a constant as the key, then put some code into the attribute class itself to load the resource.

提交回复
热议问题