<see langword="true" /> if the object implementing IEnumberable has a Count
property; otherwise <see langword="false" />.
Wow. That's even geeky for me.. ;)
Not in general. There may not even be a sensible meaning to that. For
instance, it would be possible (potentially useful even) to write an
IEnumerable implementation on top of TextReader, so you could do:
foreach (string line in new LineReader(myTextReader))
{
}
Now, potentially that TextReader is coming over a network connection
which may keep giving text forever.
Alternatively, a random number generator could implement IEnumerable -
again, no sensible concept of count.
--
Jon Skeet - <sk...@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Check to see whether the object implements ICollection (which has a Count
property).
If a class is IEnumerable and has a Count then I can't think of a good
reason why it would not implement ICollection since ICollection =
IEnumerable + Count + a few methods that MUST be implementable.
Better yet overload your method with one taking ICollection