【发布时间】:2014-07-03 00:55:03
【问题描述】:
我有一个列表
public static List<registry> regs = new List<registry>();
public struct registry
{
public int from;
public int rows;
public bool isValid;
public DateTime date;
public List<T> result;
public bool ok;
}
我正在使用以下代码从 regs 获取注册表:
registry x = regs.SingleOrDefault(p => p.from == from && p.rows == rows);
if (x.isValid == false) //checking if its default
{
regs.Add(new registry() { ok = true});
x = regs.Last();
}
然后,我想更新那个单一的值。我正在尝试简单地更新值,但它不起作用。
x.isValid = true;
它只是更新 X,而不是列表。我该怎么办?
【问题讨论】:
标签: c# wpf linq properties