Код: Выделить всё
public Class Comments
{
public string CommenterName { get; set; }
public string PostId { get; set; }
public int Id { get; set; }
public string Message { get; set; }
public long ModificationTime { get; set; }
}
Я попробовал следующий код :
Код: Выделить всё
Comment.Where(comment => comment.PostId == postId)
.GroupBy(comment => new { comment.CommenterName }, comment => comment)
.Select(comment => comment.OrderByDescending(i => i.ModificationTimeUnixTimeInMs).First())
.Select(comment => new
{
Id = comment.Id,
Message = comment.Message
})
.ToList()
Я получаю следующую ошибку:
Выражение LINQ 'ProjectionBindingExpression : 0' невозможно перевести.
Можете ли вы мне помочь?
Я использую .NET 6
Подробнее здесь: https://stackoverflow.com/questions/783 ... fferent-cl
Мобильная версия