I am working on a project and I noticed that the person used a list for a piece of code. Had it been me, I would have used an array simply out of personal preference because that is what I know. Looking at the code below, what benefit would choosing the list have over the array?
List<string> errors = new List<string>();
if (ddDirector.SelectedItem.Value == "")
errors.Add("You must select an item in the Director list.");
if (errors.Count > 0)
{
ErrorList.InnerHtml = "Please correct the following issues below:<br/><ul>";
foreach (string e in errors)
{
ErrorList.InnerHtml += String.Format("<li>{0}</li>", e);
}
ErrorList.InnerHtml += "</ul>";
}
return (errors.Count()==0);