请问如何在不使用foreach的情况下将guid的所有列表保存在List对象中,并且想将所有guid的数据发送到db方法
var folderRequestIDs = from GridViewRow msgRow in gvwSearchResult.Rows
where ((CheckBox)msgRow.FindControl("chkSNO")).Checked
select ((Label)msgRow.FindControl("lblFolderRequestId")).Text;
foreach (string Id in folderRequestIDs)
{
dataSave(Id, "New")
}
您可以使用string.join将列表中的所有ID与“,”或您想要的任何其他符号连接在一起。
var idList = string.Join(",", folderRequestIDs);//you will get a string "id1,id2,id3..."
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句