I am trying to find if a list is Empty. Whats the most efficient way.
IEnumerable<int> TestProp={get; set;}
this TestProb will be populated by another method. when I try to check if list is empty and I have to do this many times few 100s atleast. Right now I see it as
var cnt=TestProp.ToList().Count>0;
I know IEnumerable
will try to find Count property by converting to ICollection but what I am looking here is best performant way for finding non empty list. I somehow feel ToList()
is not needed here.