【发布时间】:2011-10-11 04:28:46
【问题描述】:
可能的重复:
Coalesce operator and Conditional operator in VB.NET
Is there a VB.NET equivalent for C#'s ?? operator?
是否有等效于 C# 空值合并运算符的内置 VB.NET?
【问题讨论】:
-
自 VS 2015 以来,现在可以使用 ?。在 vb.Net 中。
Dim x = Obj?.Child?.AnotherChild?.Something?.AStringx 是一个字符串,如果任何对象都不是,则为 Nothing,如果所有对象都不是,则设置。 -
@Edamreed 你应该至少回答其中一个重复项或这个问题。
-
@Edamreed
?.是空条件运算符(又名安全导航运算符),而不是问题询问的??空合并运算符。
标签: vb.net null-coalescing-operator