I want to change the money value in my list, but I always get an error message:
Cannot modify the return value of 'System.Collections.Generic.List.this[int]' because it is not a variable
What is wrong? How can I change the value?
struct AccountContainer
{
public string Name;
public int Age;
public int Children;
public int Money;
public AccountContainer(string name, int age, int children, int money)
: this()
{
this.Name = name;
this.Age = age;
this.Children = children;
this.Money = money;
}
}
List<AccountContainer> AccountList = new List<AccountContainer>();
AccountList.Add(new AccountContainer("Michael", 54, 3, 512913));
AccountList[0].Money = 547885;