读书人

expression is a value and therefore

发布时间: 2013-04-12 18:33:11 作者: rapoo

expression is a value and therefore cannot be the target of an assignment
问个问题,定义了一个List<T> list变量,T为自定义的一个struct,实例化一个struct后,再Add到list中。
然后,我需要重新遍历list修改刚刚加入的struct实例中的某个属性,就报了以上错误,应该怎么解决啊?


For i As Integer=0 to list.Count-1
list.Item(i).name="new-name" '此处报错

[解决办法]
For i As Integer=0 to list.Count-1
list(i).name="new-name" '此处报错

读书人网 >VB Dotnet

热点推荐