本文介绍了会话变量引用后的问号(?)-这是什么意思的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个代码片段可以修改.在这里,我发现了这种语法.

I have had a code snippet comes to modify. In there i found this such syntax.

Session("LightBoxID")?.ToString()

我不明白问号(?)是什么意思.谷歌搜索没有帮助我任何提示

I didn't understand what is that Question mark (?) there means. No googling helped me about any hint

推荐答案

在尝试调用 .ToString() Session("LightBoxID")进行空检查./code>.

It performs a null-check on Session("LightBoxID") before attempting to call .ToString() on it.

MS Docs:空条件运算符?.?[]

MS Docs: Null-conditional operators ?. and ?[]

这篇关于会话变量引用后的问号(?)-这是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 01:58