If I have a list of items (e.g. List<string> items
) in C#, I can use both:
items.Count()
and
items.Count
to get the total number of items. Is there a reason for them both being available? Why not just have the method .Count()
?
I notice that if I filter the list (and and end up with an IEnumerable<string>
):
items.Distinct().Count()
then .Count()
has to be used. So why does List<string>
allow .Count
at all?