Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • A dictionary makes this method far simpler, but may make the other processing more complex. For example, a dictionary won't preserve order, and most people will complain if adding an item to your cart shuffles the order of the items, etc. Commented Aug 31, 2013 at 23:14
  • Sure, but usually I do not use plain collections for this purpose. I will start off with a collection and then put it in a class that will help me organize the issue. e.g. you can then add an array that will help with ordering the cart once you need to put it on screen. Commented Aug 31, 2013 at 23:17