How do I remove items from a IEnumerable that match specific criteria?
RemoveAll() does not apply.
IEnumerable as an interface does not support removal.
IEnumerable instance is actually of a type that supports removal (such as
List<T>) then you can cast to that type and use the
Alternatively you can copy items to a different
IEnumerable based on your criteria, or you can use a lazy-evaluated query (such as with Linq's
.Where) to filter your
IEnumerable on the fly. Neither of these will affect your original container, though.