我是可空的新手。
可能的符号之间是否存在有意义的差异?string?[] str
string[]? str
甚至 string?[]? str
似乎都是有效的
最佳答案
当我们放 ?
之后 reference type我们允许实例为 null
.所以我们有
string?[]
- 字符串数组,我们允许项目为 null
(但数组本身不能是 null
)string[]?
- 字符串数组,可以是 null
本身(但它不能有 null
项)string?[]?
- 数组及其项都允许为 null
关于c# - 可空数组表示法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67791029/