views:

403

answers:

2

Possible Duplicate:
count vs length vs size in a collection

Am I overlooking a semantic difference between "Length" and "Count", or did perhaps some implementation detail in the .NET Framework require different names for these similar concepts? Given the close attention that was paid to naming and everything else in the framework, there must be a good explanation.

+2  A: 

This is a duplicate of http://stackoverflow.com/questions/300522/count-vs-length-vs-size-in-a-collection/300540 (You can find a good answer there, incl. other variations as well.)

Alex
Strangely this didn't come up in the auto-search. Thanks! (Is it proper to delete the question?)
James M.
@Alex: IMO, this would have served better as a comment
Marc Gravell
+2  A: 

Actually these are similar but not identical concepts. Since an array's length is static and its memory gets allocated once and for all (int[] intarray = new int[10]; // allocates the memory for 10 ints) the Length property is quite static. Otherwise Enumerables like a List might not know their Length beforehand so the Property Count will in some way "count" the length (you might iterate through all associated elements in an enumerable). That's the basic difference.

Max