我想更改列表中的货币价值,但总是收到一条错误消息:
无法修改“System.Collections.Generic.List.this[int]”的返回值,因为它不是变量
怎么了?如何更改值?
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;