会话变量引用后的问号(?)-这是什么意思 [英] Question Mark (?) after session variable reference - What does that mean

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

问题描述

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

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 ?[]

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆