3
Answers

How can i calculate amount of total items added to a list?

Photo of shosho shosho

shosho shosho

10y
821
1
I have a list which records the number of items. so when the user clicks "add to cart"
the item gets added to this list.
My question is how can i add the total number of items in this list.




Thank You in advance

Answers (3)

0
Photo of Guest User
Tech Writer 4.2k 2.3k 10y
A List has a Count property, is that what you are looking for? If not, please provide some code to explain what you have exactly.
Accepted
1
Photo of Vincent Maverick Durano
124 14.9k 4.2m 10y
List has a Count() extension method that you can use to get the actual item counts in the list. So you could do:

int count = YourList.Count();
0
Photo of shosho shosho
NA 56 20.1k 10y
Thanks to the both of you for your answers :) !