FatAntelope.XNode.GetDescendantCount C# (CSharp) Method

GetDescendantCount() public method

public GetDescendantCount ( ) : int
return int
        public int GetDescendantCount()
        {
            if (descendantCount >= 0)
                return descendantCount;

            var count = 0;
            count += Attributes.Length;
            count += Children.Length;

            foreach (var child in Children)
                count += child.GetDescendantCount();

            return descendantCount = count;
        }