I have the following two lists:
var feedbackTaskHistory = _context.FeedbackTasks
.Select(ft => new { ft.Id, ft.DateCreated })
.GroupBy(ai => ai.DateCreated.ToString(@"yyyy-MM-dd"))
.Select(g => new
{
Id = g.Key,
a= g.Where(ad => ad.DateCreated <= Convert.ToDateTime(g.Key)).Count(),
})
.ToList();
//[{Id=2019-11-09, a=3}, {Id=2019-11-10, a=3}, {2019-11-11, a=5}]
var discussionPostHistory = _context.RubricItemScoreComments
.Select(ft => new { ft.Id, ft.RubricItemId, ft.DateCreated })
.GroupBy(ai => ai.DateCreated.ToString(@"yyyy-MM-dd"))
.Select(g => new
{
Id = g.Key,
b= g.Where(ad => ad.DateCreated <= Convert.ToDateTime(g.Key)).Count(),
})
.ToList();
//[{Id=2019-11-10, b=1}, {2019-11-11, b=2}, {2019-11-12, b=1}]
I want to merge these two lists using OUTER JOIN to get the following list:
[
{Id=2019-11-09, a=3, b=0},
{Id=2019-11-10, a=3, b=1},
{Id=2019-11-11, a=5, b=2},
{Id=2019-11-12, a=0, b=1},
]
I am planning to use iterate through the lists but this does not sound efficient. I may have around 100 items in both lists. I wonder if there is a performance-efficient way of achieving this task. Any suggestions?