Collection Class object enhancements
- From: "wb" <none>
- Date: Tue, 6 Jun 2006 08:48:05 -0700
I have a collection class that I created to store LineItem objects of a
shopping cart. End users can scan items into the shopping cart through a
barcode scanner and each item is added. Users may or may not change the
quantity when they do this so it is possible to have one line(row) for each
of the same items or one row for all of the same items.
Inside my collection class I want to have something that tabulates the total
of each item.
NC001 4
NX003 3
TR943 2
Because this is a collection object, I expose a Count method that gives the
total number of line items, not necessarily the total count of items.
I also created a countNumberId function that takes the item Id (NC001) and
will return the sum of quantity. this works by simply testing each line
item against the parameter and if it matches then it adds the quantity to a
variable and then at the end of the loop will return that number. This
works ok, but I think there might be a better way to accomplish this.
Suggestions?
WB
.
- Follow-Ups:
- Re: Collection Class object enhancements
- From: Ralph
- Re: Collection Class object enhancements
- From: Larry Serflaten
- Re: Collection Class object enhancements
- Prev by Date: Re: Extended ListView Control
- Next by Date: Re: Screen resolution problem
- Previous by thread: Re: c# to vb.net
- Next by thread: Re: Collection Class object enhancements
- Index(es):
Loading