I'm adding validation attributes to the properties of my class. I have a library, let's just say a third party library, that contains a StringLengthAttribute
. We know that there's an attribute with the same name under System.ComponentModel.DataAnnotations
.
I'm using both the third party and System.ComponentModel.DataAnnotations
in the class that I'm creating. That causes an ambiguity on StringLengthAttribute
. The compiler suggested to use @
in the attribute like this [@StringLength()]
. That's what I did, but when I tried to F12
(Go to definition) it brought me to the third party library.
I would like to understand how the @
sign in the attribute really works and I want to use the System.ComponentModel.DataAnnotation.StringLengthAttribute
rather than the third party, how should I do that given that both namespaces of the thirdparty and DataAnnotation
are declared on the using part on top of the class.
[@StringLength(10)]
public string Name { get; set; }