I have a popuplated IEnumerable collection.
I want to remove an item from it, how can I do this?
foreach(var u in users)
{
Try turning the IEnumerable into a List. From this point on you will be able to use List's Remove method to remove items.
To pass it as a param to the Remove method using Linq you can get the item by the following methods:
users.Single(x => x.userId == 1123) users.First(x => x.userId == 1123)The code is as follows:
users = users.ToList(); // Get IEnumerable as List
users.Remove(users.First(x => x.userId == 1123)); // Remove item
// Finished