If _scheduleList
is a Generic.List
you can simply use the ForEach
extension to update the list.
_scheduleList.ForEach(c =>
{
c.TeamA = c.TeamA=="as roma" ? "roma" : c.TeamA;
c.TeamB = c.TeamB=="as roma" ? "roma" : c.TeamB;
});
If you wish just to select the items that have been updated, you can do something like this.
var updatedItemsList = _scheduleList.Where(c => c.TeamA=="as roma" || c.TeamB=="as roma")
.Select(c => c).ToList();
updatedItemsList.ForEach(c =>
{
c.TeamA = c.TeamA=="as roma" ? "roma" : c.TeamA;
c.TeamB = c.TeamB=="as roma" ? "roma" : c.TeamB;
});