DataAnnotations MaxLength and StringLength for string [] or List <string>?
I am trying to figure out if there is a way to do this with DataAnnotations:
Have an array or list of strings in which the maximum number of elements in the array or list is 2 elements and each row can contain only 255 characters. Will this work:
[MaxLength(2)]
[StringLength(255)]
public string[] StreetAddress { get; set; }
I would prefer not to create a new class just to hold the string property Valueto limit each line to 255 characters.
+4
1 answer