Lin*_*say 7 .net c# linq generics ienumerable
我无法从IEnumerable列表中删除元素,但此列表是对List的引用,List是其他类的私有属性.如果我放入personsCollection.Remove(theElement)同一个类(类管理器),它的工作完美,但我需要删除该元素,因为其他类(类ManagerDelete).请问我该怎么做?谢谢.
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>();
}
Run Code Online (Sandbox Code Playgroud)