Removing items from object collection
I am using .NET 4.0.
There is a Shop object with a List o开发者_JS百科f Products. A list of Product ID's are passed. How to remove the Product item from Shop object that matches the list of Product ID's
Thanks
This is homework right? I'll throw you a bone. Use a for loop to iterate through the Product IDs. Nest another for loop to loop through Products and remove the element when the ID matches Product. Break out of the inner loop (important). If the List of Products were instead a Dictionary, the solution would be better and simpler.
精彩评论