Esempio n. 1
0
        /// <summary>
        /// Removes all elements from the tree
        /// </summary>
        /// <returns>Number of removed elements</returns>
        public int Invalidate()
        {
            // make sure not to use RootNode property since
            // calling get; causes parse
            List <IAstNode> removedNodes = new List <IAstNode>();

            foreach (var child in _astRoot.Children)
            {
                removedNodes.Add(child);
            }

            _astRoot.RemoveChildren(0, _astRoot.Children.Count);

            if (removedNodes.Count > 0)
            {
                FireOnNodesRemoved(removedNodes);
            }

            return(removedNodes.Count);
        }