help me please to use the function "RemoveAll" or maybe there should be another implementation. I have an object (services) which contains a list with items. I make another object (anotherService ) which is equal with the first.
I should remove from second object (anotherService) items which have mainService == false.
I use the "RemoveAll" function, but after this action is made, from the object (services) items which are mainService = false are also removed. I need to have the first object completed how it was before removing.
var services = DictionaryObject.GetDictionaryValidatedByDate<ServiceInfo>(DictionaryType.REF_SERVICE, DateTime.Now);
var anotherService = services;
anotherService.RemoveAll(p =>
{
if (p.Model.mainService == false)
{
return true;
}
return false;
});
Thank you all.