I have this function:
public void RemoveCustomAssignmentFromPublishers(int iCustomAssignment)
{
try
{
// We need to examine each Publisher in the dictionary
foreach (KeyValuePair<string, Publisher> entry in _PublisherData.PublisherDictionary)
{
// We must remove all default exclusions where the stated custom assignment index is used
entry.Value.Assignments.CustomAssignments.RemoveAll(x => x.Index == iCustomAssignment);
}
}
catch (Exception ex)
{
SimpleLog.Log(ex);
}
}
It iterates a map and then uses LINQ to remove all items as indicated.
Can we use LINQ instead of the foreach
loop?