I am trying to create a class like this:
public class person
{
public string name { get; set;}
public int age { get; set;}
}
and create a class which is basically a list of the class above:
public class PersonList : List<person>
{
public PersonList()
{
}
public int getAge(string name)
{
foreach( string s n this)
{
if ( s == name)
return age;
}
}
My goal is to have simple function named GetAge() so I get the the age by name of any person object in my list. I know it is possible to just create a list, but I want a modular code.