|
Csdn blog 专家群 高海东 11.自定义异常处理
//自定义异常处理类
using System;
using System.Diagnostics;

namespace MyAppException
  {
 /**//// <summary>
/// 从系统异常类ApplicationException继承的应用程序异常处理类。
/// 自动将异常内容记录到Windows NT/2000的应用程序日志
/// </summary>
public class AppException:System.ApplicationException
 {
public AppException()
 {
if (ApplicationConfiguration.EventLogEnabled)LogEvent("出现一个未知错误。");
}

public AppException(string message)
 {
LogEvent(message);
}

public AppException(string message,Exception innerException)
 {
LogEvent(message);
if (innerException != null)
 {
LogEvent(innerException.Message);
}
}

//日志记录类
using System;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading;

namespace MyEventLog
  [1] [2] [3] [4] [5] [6] 下一页 |