Is there any property or function for DynamicNodeList which returns the number of list items.
This is my code:
var root = Model.NodeById(id);
var nodes = root.Descendants("ChartItem");
if (nodes.GetLength() > 0)
{
s = s + "<ul>";
}
But GetLength is not a valid function. what should I do?
There is a built in extension method for IEnumerable types called Count(), it does just that, it counts the items 🙂
See code below: