Cannot apply indexing with [] to an expression of type 'ISet<string>'

我的未来我决定 提交于 2019-12-11 06:53:33

问题


I am getting Error 'Cannot apply indexing with [] to an expression of type 'ISet''

for this code snippet

foreach (GridViewRow grv in customTableDataList.UniGrid.GridView.Rows)
{
  if (grv != null)
  {
    if (null != grv.FindControl(ItemCheckBoxID) && ((CheckBox)grv.FindControl(ItemCheckBoxID)).Checked)
    {
      //At this line I am getting error.
      itemIds += customTableDataList.UniGrid.ActionsID[rowCounter] + ", ";  
    }
    rowCounter++;
  }
}

Can anyone give some more details to resolve this.


回答1:


Add new using:

System.Linq;

and change

foreach (GridViewRow grv in customTableDataList.UniGrid.GridView.Rows)
{
  if (grv != null)
  {
    if (null != grv.FindControl(ItemCheckBoxID) && ((CheckBox)grv.FindControl(ItemCheckBoxID)).Checked)
    {
      itemIds += customTableDataList.UniGrid.ActionsID.ToArray()[rowCounter] + ", ";
    }
    rowCounter++;
  }
}


来源:https://stackoverflow.com/questions/38094873/cannot-apply-indexing-with-to-an-expression-of-type-isetstring

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!