【发布时间】:2012-05-27 00:14:04
【问题描述】:
您好,我正在尝试创建一个可以在我的项目中使用的全局类,我打算将其用作我的默认模板,我是新手,请耐心等待 ;)
Stopwatch Masterstopwatch = new Stopwatch();
#if DEBUG
private static void ApplicationLogStart()
{
StartTime = DateTime.Now;
Masterstopwatch.Start();
String eventName = "Program Loaded";
String errorDetails = "Program has started Succesfully";
DataLogEntry(eventName, errorDetails);
}
private static void ApplicationLogclosing()
{
String eventName = "Program is closing";
String errorDetails = "Program has closed Succesfully";
DataLogEntry(eventName, errorDetails);
StopTime = DateTime.Now;
Masterstopwatch.Stop();
Benchmark(StartTime,StopTime,Masterstopwatch.Elapsed);
}
#endif
我怀疑我的设计存在根本缺陷,因为我想要秒表 Masterstopwatch = new Stopwatch();要在不使用方法的情况下全局声明,我怀疑这是不可能的,但我需要问 谢谢
【问题讨论】: