打印和输出异常 - GetExceptionInfo
2017-02-26 15:20:40 访问(1431) 赞(0) 踩(0)
/// <summary>
/// 打印和输出异常 - GetExceptionInfo
/// </summary>
/// <param name="err"></param>
/// <returns></returns>
public static string GetExceptionInfo(Exception err)
{
StringBuilder theResult = new StringBuilder();
theResult.AppendLine("err.Message:" + err.Message);
theResult.AppendLine("err.Source:" + err.Source);
theResult.AppendLine("err.TargetSite:" + err.TargetSite.ReflectedType.FullName + " " + err.TargetSite.Name);
theResult.AppendLine("err.StackTrace:" + err.StackTrace);
return theResult.ToString();
}
标签:
打印和输出异常 - GetExceptionInfo 


上一条:
下一条:
相关评论
发表评论