对空传播感到困惑
Confused about null-propagation
我尝试了几种方法,但无法将以下语句转换为空传播。
可能吧,我不知道它是如何工作的。
catch (Exception ex)
{
if (VGUILogger.Instance != null)
{
VGUILogger.Instance.HandleException(ex);
}
}
你试过了吗?
VGUILogger.Instance?.HandleException(ex);
我尝试了几种方法,但无法将以下语句转换为空传播。
可能吧,我不知道它是如何工作的。
catch (Exception ex)
{
if (VGUILogger.Instance != null)
{
VGUILogger.Instance.HandleException(ex);
}
}
你试过了吗?
VGUILogger.Instance?.HandleException(ex);