c#,linq,join,two,lists

Mark 7/27/2016 0

this code will join two list of classes on primary field

C#
var posts = db.Posts.Where(p => p.TeamId == idTeam).Take(10).ToList();

posts = posts.Join(db.Members, r => r.MemberId, m => m.Id, (r, m) => new Post
{
    CreateDate = r.CreateDate,
    Header = r.Header,
    MemberId = r.MemberId,
    PostMember = m,
    PostId = r.PostId
}).ToList();
 

Report Bug

Please Login to Report Bug

Reported Bugs

Comments

Please Login to Comment

Comments