categoryList.ForEach(p => p.Description = "-1"); var zpclist = from t in categoryList let tp = (from p in categoryList.Select(s => s.ParentRowGuid) select p) where !tp.Contains(t.RowGuid) select t; string projectRowGuid = zpclist.FirstOrDefault().ProjectRowGuid; var joined = from g in zpclist join e in dc_DocData.BidSectionShareDocumentEFile.Where(p => p.ProjectRowGuid == projectRowGuid) on g.RowGuid equals e.ParentRowGuid into ge select new { g, ge }; foreach(var j in joined) { if (j.ge.Count() > 0) { j.g.Description = "1"; } else { j.g.Description = "0"; } }