2011年5月15日 星期日

[C#] byte[] to hex format string

            StringBuilder sb = new StringBuilder(byteData.Length * 2);
            foreach (byte b in byteData)
            {
                sb.AppendFormat("{0:x2}", b);
            }

2011年5月2日 星期一

[C#] log4net 設定檔變數

  %m(message):輸出的日志消息,如ILog.Debug(…)輸出的一條消息
  %n(new line):換行
  %d(datetime):輸出當前语句運行的時刻
  %r(run time):輸出程序從運行到執行到當前語句時消耗的毫秒數
  %t(thread id):當前語句所在的線程ID
  %p(priority): 日志的當前優先級别,即DEBUG、INFO、WARN…等
  %c(class):當前日志對象的名稱
  %L:輸出語句所在的行號
  %F:輸出語句所在的文件名
  %-數字:表示該項的最小長度,如果不夠,則用空格填充