I have this class :
public class Item
{
public int Id { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
}
I want to store instances of Item in a list, and keep it ordered like the user has ordered them (Likely to be in a GUI with up-down arrows while selecting an Item)…
Should I be adding an order member to my Item class, or is there a specific datastructure that can keep an arbitrary user-specified order.
Note: I’m going to use this to keep a list of items, in the order a person has seen them, walking in a store.
If you intend to persist the list to a database then you may want to include an Order property in your Item class; databases such as SQL Server do not guarantee the order of the result set.