Creating New List From Existing List in Linq C# | Compare 2 Linq Lists and Get Which Items not exist in Previous List c#
//1.Creating New List From Existing
List<City> LstCityUpdate = db.Cities.Select(a => new City()
{
CityID = a.CityID,
CityName = a.CityName,
IsActive = true
}).ToList();
//2.Compare 2 Linq Lists and Get Which Items not exist in Previous List
List<City> Lst = LstCity.Where(s => !LstCityUpdate.Where(es => es.CityID == s.CityID).Any()).ToList();
Comments
Post a Comment