i have dictionary
has id key , list of lists value. count of how many lists inside list. appears give correct value when query whilst debugging when go try , access data gives count of 1 rather 2. i'm sure it's i'm missing can't put finger on it.
here's count when check through debugging:
and here's when try access count of 2:
the whole method is:
public static list<string> getstatisticscsvheaders(list<items> itemlist, dictionary<int, list<list<statistic>>> availablestats) { list<string> toprow = new list<string>(); (int = 0; < availablestats.values.count; i++) { toprow.add("phase " + (i+1)); (int k = 0; k < itemlist.count; k++) toprow.add(getmetricheader(itemlist[k], true)); } return toprow; }
i'd have number of lists inside list counter line i < availablestats.values.count
.
edit: should mention i've tried availablestats.values[0].count
won't compile.
debugger shows have single item in dictionary, , item list 2 elements. because code taking count of item in dictionary you're getting 1.
to number of items in lists in dictionary, try linq , sum
:
availablestats.values.sum(x => x.count)
Comments
Post a Comment