System.Windows.Forms.TreeNode._GetVisibleNodesAmount C# (CSharp) Method

_GetVisibleNodesAmount() private static method

private static _GetVisibleNodesAmount ( TreeNode node, int currentAmount ) : int
node TreeNode
currentAmount int
return int
        private static int _GetVisibleNodesAmount(TreeNode node, int currentAmount)
        {
            if (node.IsVisible) currentAmount++;
            else return currentAmount;

            if (node.IsExpanded)
                for (int i = 0; i < node.Nodes.Count; i++)
                    currentAmount = _GetVisibleNodesAmount(node.Nodes[i], currentAmount);

            return currentAmount;
        }