Say, I have a Person object list called people:
public class Person
{
public int age;
public string name;
public Person(int age, string name)
{
this.age = age;
this.name = name;
}
}
List<Person> people = new List<Person>();
The list is populated with a large amount of people data. How do I get a list of all the names used in the list, but only one occurrence for each name? For example, if in the people List there are 1000 people with the firstname 'Bob' and 200000 with the firstname 'Alice', my list should contain only one entry for 'Bob' and one entry for 'Alice'.