递归很简单: string GetInnerException(Exception ex)
{
if (ex.InnerException != null)
{
return GetInnerException(ex.InnerException);
}
return ex.Message; }
{
if (ex.InnerException != null)
{
return GetInnerException(ex.InnerException);
}
return ex.Message; }
while (ex.InnerException != null)
{
ex = ex.InnerException;
str += ex.ToString(); // ex.Message;
}