我想改变我的列表中的货币价值,但我总是得到一个错误信息:无法修改列表中的结构?
不能修改的“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;
可惜关于'Point',''Rectangle''和'Size'。至少微软在制作'Complex'之前学会了一点。如果*是可变的,那将会非常令人讨厌。 –