using System.Collections.Generic;
public int MsgID { get; set; }
public string Content { get; set; }
public override string ToString() => $"{MsgID} | {Content}";
public int MsgID { get; set; }
public string Content { get; set; }
public int Status { get; set; }
public static void Main()
List<Message> messages = new()
new() { MsgID = 1, Content = "aaa" },
new() { MsgID = 2, Content = "bbb" },
new() { MsgID = 3, Content = "ccc" },
new() { MsgID = 4, Content = "ddd" },
new() { MsgID = 5, Content = "eee" }
List<Sent> sentList = new()
new() { MsgID = 1, Content = "aaa", Status = 0 },
new() { MsgID = 3, Content = "ccc", Status = 0 }
List<Message> result = messages
.ExceptBy(sentList.Select(msg => msg.MsgID), msg => msg.MsgID)
Console.WriteLine(string.Join(Environment.NewLine, result));