I got a list of objects in the following query. How to delete items in the middle, saying I want to delete item in 2, 5, and 7 position? thanks
var archivedPwds = from archivedPwd in db.PasswordArchive
where archivedPwd.UserId == userId
orderby archivedPwd.DateChanged
select archivedPwd;
EDIT:
I am using L2E and want to delete those items from database.
You cannot “delete” items from an
IEnumerableorIQueryable. What you can do is filter them out, or build another collection out of the filtering results.Filtering by index is still done by Where: