myclass.cs

来自「.NET 2.0模式开发实战源代码,使用C#说明」· CS 代码 · 共 54 行

CS
54
字号
using System;using System.Collections;namespace DbgMgr {    public class DebugMgr {        private static Stack _stack = new Stack();        private static int _debugLevel = 0;        public static void assignDebugFlags( int debugLevel) {            _debugLevel = debugLevel;        }        public static void start( int debugLevel, string buffer) {            if( debugLevel <= _debugLevel) {                output( debugLevel, "**** start (" + buffer + ") ****");                _stack.Push( buffer);            }        }        public static void end( int debugLevel) {            if( debugLevel <= _debugLevel) {                string identifier = (string)_stack.Pop();                output( debugLevel, "**** end (" + identifier + ") ****");            }        }        public static void output( int debugLevel, string buffer) {            if( debugLevel <= _debugLevel) {                int counter = 0;                while( counter < _stack.Count) {                    Console.Write( "    ");                    counter += 1;                }                Console.Write( buffer);                Console.Write( "\n");            }        }        public static void outputVar( int debugLevel, string identifier, object buffer) {            if( debugLevel <= _debugLevel) {                int counter = 0;                while( counter < _stack.Count) {                    Console.Write( "    ");                    counter += 1;                }                Console.Write( identifier);                Console.Write( "(");                Console.Write( buffer);                Console.Write( ")\n");            }        }    }}// project created on 9/24/2004 at 8:23 PM

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?