Need help on compliation error.
Hello to C# experts,
I need help with this compliation error:
Cannot apply indexing with [] to an expression of type 'object'
else
{
try
{
OrderItem drinkOrder = new OrderItem("","",0,0.0m); // Referencing from a class within a package.
drinkOrder[itemCountInteger].quantityInteger
= int.Parse(quantityTextBox.Text);
if (drinkOrder[itemCountInteger].quantityInteger != 0)
{
drinkOrder[itemCountInteger].drinkString
= drinkTypeComboBox.SelectedItem.ToString();
drinkOrder[itemCountInteger].priceDecimal
= itemPriceDecimal;
totalOrderDecimal += itemPriceDecimal
* drinkOrder[itemCountInteger].quantityInteger;
drinkTotalInteger += drinkOrder[itemCountInteger]
.quantityInteger;
clearForNextItem();
orderCompleteButton.Enabled = true;
itemCountInteger++;
}
________________________________________________________________
those i highlighted in blue are those with the blue swiggly after i place in the code for referencing those variable from a class.
My tutor told the class to try it as a challenge but after i got to this point i am stuck, not sure how to continue this.
So really need some help from C# experts to explain to me how to solve so i will be able to solve it easily in future.