I'm trying to access the Count Property on the array of rows returned by the datatables select method, this is after converting the Web Project to 3.5
views:
1087answers:
2ok but the codebase already uses .count in alot of places and was originally working.... am I missing a reference or something
keyoke
2009-04-21 16:06:46
Odd.. arrays have never had a .Count property. I wonder if that used to be a 'hack' in the system that they had to remove to avoid conflicted with IEnumerable.count
Joel Coehoorn
2009-04-21 16:10:57
in msdn when looking at the System.Array members/properties if you select 2.0 as the framework there is no count property but if you select 3.5 it appears.
keyoke
2009-04-21 16:34:24
Because arrays implement IEnumerable, and in 3.5 IEnumerable and .Count extension.
Joel Coehoorn
2009-04-21 16:39:41
And you don't want to rely on that, because it means actually iterating over the array and counting the elements, rather than just looking it up.
Joel Coehoorn
2009-04-21 16:40:17
Just remember that .Length is 0-based and .Count is 1-based. If an Array contains [Steve|Tom|George] then .Length() will return 2 and .Count() will return 3.
STW
2009-04-21 19:32:57
@Yooder that's wrong.
Joel Coehoorn
2010-05-05 21:52:16