list.ForEach的用法

Templist.ForEach(o =>

{

   var isSel = ReviewerFileRelationService.Where(s => s.PackageFileId == o.Id && s.ReviewerId == o.ContactId).AsQueryable().FirstOrDefault();

   if (isSel != null)

   {

       o.Contact = "<input type=\"checkbox\" checked onchange='set(this)' class=\"chk\" id=\"" + o.Id + "_" + o.ContactId + "\" /><label for=\"" + o.Id + "_" + o.ContactId + "\" >" + o.UserName + "</label> ";

   }

   else

   {

       o.Contact = "<input type=\"checkbox\" onchange='set(this)' class=\"chk\" id=\"" + o.Id + "_" + o.ContactId + "\" /><label for=\"" + o.Id + "_" + o.ContactId + "\" >" + o.UserName + "</label> ";

   }

});

 

你可能感兴趣的:(foreach)