Grouping of Lists:
var list = ssrsObj.GetData();
var g=from p in list
group p by new {login= p.login, Name= p.Name} into grp
select new
{
AssigneeLogin=grp.Key.login,
AssigneeName=grp.Key.Name,
IncCounts=grp.Count()
};
Joining Two Lists:
var joinList = from p in list1
join q in list2
on p.AgentLogin.ToLower() equals q.AssigneeLogin.ToLower() into grp
from x in grp.DefaultIfEmpty()
select new
{
// below statement shows if value x is null replace it with other value
// p == null ? 10 : p.CCounts
// ? mark says that if p == null ? then assign x == 10 where x== p.CCounts
ssrslogin = x == null ? p.AgentLogin : x.AssigneeLogin ,
ssrsname = x == null ? p.AgentName : x.AssigneeName,
ssrscount = x == null ? 0 : x.ICounts,
calllogin = p == null ? x.AssigneeLogin : p.AgentLogin,
callname = p == null ? x.AssigneeName : p.AgentName,
callcount = p == null ? 0 : p.CCounts,
};