编译后,函数名应写在.txt文件中

时间:2010-07-13 08:59:32

标签: c#-3.0

如何在mcb.txt中编写函数名称

class Program
{

   static FileStream fs = new FileStream(@"c:\vijay\mcb.txt", FileMode.OpenOrCreate, FileAccess.Write);
   static StreamWriter m_streamWriter = new StreamWriter(fs);
   static void Main(string[] args)
   {
        Program.log("function()");
        Program.Trace("message");
        Program.Error("error");
   }

   public static void log(string text)
   {


   }

   public static void Trace(string time)
   {

        m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);
        m_streamWriter.Write(" File Write Operation Starts : ");
        m_streamWriter.WriteLine("{0} {1}", DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString());
   }

   static public void Error (string er)
   {


   }    
}

1 个答案:

答案 0 :(得分:0)

为什么重新发明轮子? System.Diagnostics包含您需要的一切......

http://msdn.microsoft.com/en-us/library/sk36c28t(v=VS.85).aspx