I need to add decimal numbers held in the last index of arraylists, to a decimal subtotal, for Windows Forms. My processOrder MenuItem gives error:
subList1 does not exist in the current context.
But subLists are ok in my AddtoCart MenuItem method when using .Add. If I enter
subtotal = (subList1.RemoveAt(3) + subList2.RemoveAt(3)); in AddtoCart() as a test the error is:
cannot use + operator with operands of type void and void.
I do not want to use another class and getters. Doesn't matter if values are removed, I just need to obtain the values and add them for my solution to work.
ArrayListis deprecated. UseList<T>instead (yes, that requires a class. C# is OOP).RemoveAtis for removing and not reading values.