Накидал пример, получите все айдишники повторных комментариев, которые надо удалить.
static void Main(string[] args)
{
var comments = new[]
{
new Comment { Id = 1, Text = "1" },
new Comment { Id = 2, Text = "2" },
new Comment { Id = 3, Text = "3" },
new Comment { Id = 4, Text = "1" },
new Comment { Id = 5, Text = "2" },
new Comment { Id = 6, Text = "2" },
new Comment { Id = 7, Text = "1" },
new Comment { Id = 8, Text = "4" },
new Comment { Id = 9, Text = "5" },
new Comment { Id = 10, Text = "2" },
};
var result = comments
.GroupBy(x => x.Text)
.SelectMany(x => x.Select(y => y.Id).Skip(1))
.ToArray();
foreach (var id in result)
{
Console.WriteLine($"{id}");
}
Console.ReadKey();
}
class Comment
{
public int Id { get; set; }
public string Text { get; set; }
}