Alex Rivera | Logout

StringLength vs MaxLength attributes ASP.NET MVC with Entity Framework EF Code First

Asked 2011-04-19T13:23:23.207
192

What is the difference in behavior of [MaxLength] and [StringLength] attributes?

As far as I can tell (with the exception that [MaxLength] can validate the maximum length of an array) these are identical and somewhat redundant?

Edit
Report

1 Answer

6

One another point to note down is in MaxLength attribute you can only provide max required range not a min required range. While in StringLength you can provide both.

answered 2013-06-17T13:41:03.267

Your Answer