What is the best way to check null
or empty for IEnumerable<double>
in C#?
What I have tried so far is
return returnList != null && returnList.Any();
but I get a message that this expression will always return true
.
Full method:
public double ArithmeticMean(IEnumerable<double> ReturnsList, bool IsMonthly)
{
var returnList = ReturnsList.Mean();
if (IsMonthly)
{
return returnList;
}
else
{
return returnList * Math.Pow(12, 0.5);
}
}