C# Set Data Annotation on List<string> [duplicate]
问题 This question already has answers here : Required Attribute on Generic List Property (4 answers) Closed 7 years ago . I have this piece of code: [Required] public List<string> myStringList { get; set; } Unfortunatelly, it doesn't work, tha validator totally ignores it. Besides, this works fine: [Required] public string myString { get; set; } and DateTimes work fine as well. Obviously, the problem doesn't lie on my validator, but on the annotation. So the question is, how should I set the Data