Nie mogę usunąć elementu z listy IEnumerable, ale ta lista jest odniesieniem do listy, prywatnym atrybutem innej klasy. Jeśli wstawię personsCollection.Remove(theElement)
w tej samej klasie (Menedżer klasy), działa idealnie, ale muszę usunąć element, ponieważ druga klasa (klasa ManagerDelete). Jak mogę to zrobić? Dzięki.Usuwanie elementu z ogólnej listy
class Other
{
//Some code
public IEnumerable<Person> SearchByPhone (string value)
{
return from person in personCollection
where person.SPhone == value
select person;
}
}
class ManagerDelete
{
//Some code
IEnumerable<Person> auxList= SearchByPhone (value);
//I have a method for delete here
}
class Manager
{
//Some code
private List<Person> personsCollection = new List<Person>();
}
'ILIST' nie jest konieczne," ICollection "wystarczy. – svick