Редактирование элемента структуры c#
Вот структура которая состоит из имени и возраста человека. Как изменить имя и возраст н-ого человека в структуре? И вывести уже измененную структуру на экран.
public struct persons
{
public string name;
public int age;
public persons(string _name, int _age) : this()
{
this.name = _name;
this.age = _age;
}
}
static void Main(string[] args)
{
List<persons> person = new List<persons>();
int m = 4;
for(int i=0; i<m; i++)
{
string onePerson = Convert.ToString(Console.ReadLine());
string[] wrPerson = onePerson.Split(new char[] { ' ' });
person.Add(new persons(wrPerson[0], Convert.ToInt32(wrPerson[1])));
}
for(int i=0; i<m; i++)
{
WriteLine(person[i].name + " " + person[i].age);
}
int n=Convert.ToInt32(Console.ReadLine());
}