C# attribute text from resource file?

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

    The nature of attributes is such that the data you put in attribute properties must be constants. These values will be stored within an assembly, but will never result in compiled code that is executed. Thus you cannot have attribute values that rely on being executed in order to calculate the results.

提交回复
热议问题