I have a popuplated IEnumerable
collection.
I want to remove an item from it, how can I do this?
foreach(var u in users)
{
There is now an extension method to convert the IEnumerable<>
to a Dictionary<,>
which then has a Remove
method.
public readonly IEnumerable Users = new User[]; // or however this would be initialized
// To take an item out of the collection
Users.ToDictionary(u => u.Id).Remove(1123);
// To take add an item to the collection
Users.ToList().Add(newuser);