コード例 #1
0
        /// <summary>
        /// Visit all blocks
        /// </summary>
        /// <param name="block"></param>
        /// <param name="onBlockEnter">Called when enters a block</param>
        /// <param name="onBlockLeave">Called when leaves a block</param>
        /// <returns></returns>
        public static int Visit(Block block, BlockHandler?onBlockEnter = null, BlockHandler?onBlockLeave = null)
        {
            var visitor = new BlockVisitor(onBlockEnter, onBlockLeave);

            visitor.VisitCore(block);
            return(visitor._count);
        }
コード例 #2
0
        /// <summary>
        /// Visit all blocks
        /// </summary>
        /// <param name="blocks"></param>
        /// <param name="onBlockEnter">Called when enters a block</param>
        /// <param name="onBlockLeave">Called when leaves a block</param>
        /// <returns></returns>
        public static int Visit(IEnumerable <Block> blocks, BlockHandler?onBlockEnter = null, BlockHandler?onBlockLeave = null)
        {
            var visitor = new BlockVisitor(onBlockEnter, onBlockLeave);

            visitor.VisitCore(blocks);
            return(visitor._count);
        }