Could anyone please teach me how to insert item into list in alphabetical order in C#?
So every time I add to the list I want to add an item alpabetically, the list could become quite large in theory.
Sample Code:
Public Class Person
{
public string Name { get; set; }
public string Age { get; set; }
}
Public Class Storage
{
private List<Person> people;
public Storage
{
people = new List<Person>();
}
public void addToList(person Person)
{
int insertIndex = movies.findindex(
delegate(Movie movie)
{
return //Stuck here, or Completely off Track.
}
people.insert(insertIndex, newPerson);
}
}