Hey so i have this code where i check to see if a player can remove an 'Item' from their inventory. The 'Inventory' is a Sorted Dictionary(Item, int) (subquestion: do i NEED a sorted dictionary to be able to access items in it with an index number??), and an Item is a class.
public bool CanRemoveFromItemInventory(string item) { bool temp = false; if (ItemInventory.Count() <= 0) { return false; } else if (ItemInventory.Count() > 0) { for (int b = 0; b < ItemInventory.Count(); b++) { Item i = ItemInventory.Keys.ElementAt(b); if (i.GetName().Equals(item) && ItemInventory[i] >= 1) { temp = true; } else { temp = false; } if (!temp) { return false; } else { return true; } } } else { return temp; } }