Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I guess there's no reason for a difference between .Length and .Count that I can think of.

I guess you could make IEnumerable's Count() into a property and enjoy the same syntax but I am not sure it's a good idea, because Count() needs to enumerate and is therefore O(n), and property syntax may coax you into writing with the expectation that it is O(1).

Then suddenly (it's been years since I did c#) I recall that Count() is added to the interface as an extension method with the "this" keyword. Is it possible to have an extension property? I do not think so but again it's been a while.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: