var firstLst = new List<NotificationSettingsDto>()
{
new NotificationSettingsDto
{
NotificationSettingsId = "2",
IsEnabled = false,
EventCategories = new HashSet<string>(){"ac", "bc"},
EventNames = new HashSet<string>(){"cc", "dd"},
ChannelSettings = new HashSet<ChannelSettingsDto>()
{
new ChannelSettingsDto(){ ChannelName = "operator_notifications" }
}
}
};
var secondLst = new List<NotificationSettingsDto>()
{
new NotificationSettingsDto
{
NotificationSettingsId = "2",
IsEnabled = false,
EventCategories = new HashSet<string>(){"ac", "bc"},
EventNames = new HashSet<string>(){"cc", "dd"},
ChannelSettings = new HashSet<ChannelSettingsDto>()
{
new ChannelSettingsDto(){ChannelName = "operator_notifications"}
}
}
};
var changedItems = firstLst
.Join(secondLst,
f => f.NotificationSettingsId,
s => s.NotificationSettingsId,
(f, s) => new {First = f, Second = s})
.Where(pair => !pair.First.Equals(pair.Second))
.ToList();
var firstLst = new List<NotificationSettingsDto>()
{
new NotificationSettingsDto
{
NotificationSettingsId = "2",
IsEnabled = false,
EventCategories = new HashSet<string>(){"ac", "bc"},
EventNames = new HashSet<string>(){"cc", "dd"},
ChannelSettings = new HashSet<ChannelSettingsDto>()
{
new ChannelSettingsDto(){ ChannelName = "operator_notifications" }
}
}
};
var secondLst = new List<NotificationSettingsDto>()
{
new NotificationSettingsDto
{
NotificationSettingsId = "2",
IsEnabled = false,
EventCategories = new HashSet<string>(){"ac", "bc"},
EventNames = new HashSet<string>(){"cc", "dd"},
ChannelSettings = new HashSet<ChannelSettingsDto>()
{
new ChannelSettingsDto(){ChannelName = "operator_notifications"}
}
}
};
var changedItems = firstLst
.Join(secondLst,
f => f.NotificationSettingsId,
s => s.NotificationSettingsId,
(f, s) => new {First = f, Second = s})
.Where(pair => !pair.First.Equals(pair.Second))
.ToList();