Lamda Expression to select specific columns in the Generic List
var timeWeeksDistincts = timeWeeks.Select(item => new {item.MemberId,item.TimesheetId,item.ProjectId,
item.WorkPackageId,
item.TimesheetDate
});
item.WorkPackageId,
item.TimesheetDate
});
Linq to select Distinct records
var timeWeeksDistincts = timeWeeks.Distinct();
Linq to select list based on WHERE condition
IEnumerable timeWeeksMatching = from c in timeWeeks
where c.TimesheetId == timeWeek.TimesheetId
&& c.TimesheetDate == timeWeek.TimesheetDate
&& c.ProjectId == timeWeek.ProjectId
&& c.MemberId == timeWeek.MemberId
&& c.WorkPackageId == timeWeek.WorkPackageId
select c;
where c.TimesheetId == timeWeek.TimesheetId
&& c.TimesheetDate == timeWeek.TimesheetDate
&& c.ProjectId == timeWeek.ProjectId
&& c.MemberId == timeWeek.MemberId
&& c.WorkPackageId == timeWeek.WorkPackageId
select c;
No comments:
Post a Comment