vb.net - A good way to loop and sort on several criteria -
i working on project have medium sized list (with anywhere between 10 , 30 items) iterating through. there large list of criteria used sort list. in simple terms, have 5 categories, each of 2 counters tick based off status of item. simple me do, either switch
/case
or more basic if
/elseif
. makes problem more difficult, , in opinion worthy of outside input, each item has date attached it, , 3 items per month should counted.
my approach set counter each month, , start ignore items fall within month, sure there smarter , fancier way , additional experience wonderful insight.
here code show doing now:
for each item in list if item.category = category1 if item.status = status1 category1status1 = +1 else category1status2 = +1 end if elseif item.category = category2 if item.status = status1 category2status1 = +1 else category2status2 = +1 end if elseif item.category = category3 if item.status = status1 category3status1 = +1 else category3status2 = +1 end if ''more of looping end if next
edit : perhaps helpful note can access date of item via item.date
Comments
Post a Comment