List<tBaseRolerMapPower> list =new List<tBaseRolerMapPower>()
string strName = string.Empty;
foreach (tBaseRolerMapPower item in list)
{
strName += item.power_name + ",";
}
换成:
list.ForEach(p =>
{
strName = strName + p.power_name + ",";
});
说白了 foreach (tBaseRolerMapPower item in list) 等于 ForEach(p => 以下{}中的东西都一样
原文:http://www.cnblogs.com/ln-qiqi/p/6189710.html