What\'s the difference between \"Length\", \"Count()\" and \"Rank\" for .net array?
Length
is a property of Array
since C# 1.x
Count()
is an extension method of IEnumerable
, because now every T[]
implements IEnumerable
implicitly.
Note that for an array, Count()
is usually much slower than Length
, because accessing Length
property is O(1), while Count
is for IEnumerable
, so the program needs to go through the collection and get its count, that is O(n).
Rank
gives the demensions of the array.