Custom Attribute in C# : How to create an Attribute which defines several other Attributes? -
The following attributes are defined on the My Name field:
[Required (ErrorMessageResourceName = "ValidationErrorRequiredField", ErrorMessageResourceType = typeof (MyResources)] [Display (Order = 0, name = ResxStrings.UserName, ResourceType = typeof (MyResources))] Public string name {get; Set; }
I want to create a custom attribute that looks like this:
[MyAttribute (DisplayName = "username", error message = "validation Errurpeerfield ", resource type = MyResources)] public string name {get; Set; }
defines the code in the second two ( required and displayed ) attributes.
How to apply it?
UPDATE This is not possible. Thanks to all those people who help answer my question.
I do not think you can because the characteristics of the user often type them, so your new The attribute both must be a required attribute and a DisplayAttribute. C # does not support multiple legacy, so there is no way to create such a square.
Comments
Post a Comment