我知道,有时的InnerException为null
I know sometimes innerException is null
所以下面可能失败:
repEvent.InnerException = ex.InnerException.Message;
有没有一种快速的三元方法来检查的InnerException为空或不是?
Is there a quick ternary way to check if innerException is null or not?
这是你正在寻找什么?
String innerMessage = (ex.InnerException != null)
? ex.InnerException.Message
: "";