I created the following class:
namespace Prototype.ViewModel.MyVM
{
public clas TheVm
{
List<Tuple<string, bool>> list = new List<Tuple<string, bool>>();
public List<Tuple<string, bool>> List
{
get { return this.list; }
set { this.list = value; }
}
}
}
在另一个代码文件中,我正在尝试修改封装的List>对象的其中一个值:
for (int i = 0; i < anotherList.Count; i++)
{
TheVM.List[i].Item2 = (anotherList[i].Item2 == 1);
}
但是我遇到了以下错误信息:
属性或索引器“Tuple.Item2”无法分配给“--”,因为它是只读的。
我该如何解决这个问题?
TheVM.List[i].Item2 = new Typle<string, bool>(TheVM.List[i].Item1, (anotherList[i].Item2 == 1));
- Renatas M.