MSDN 关于标准 C# 类的文档似乎没有包含该类型的 default
值。我找错地方了吗?具体来说,我试图找出 XElement
的 default
值是什么。
我总是可以运行我的程序然后弄清楚,但如果可能的话,我想要一种避免这种情况的方法。
编辑: This page显示 native 类型的默认值,但我想知道复杂类型。
最佳答案
所有引用类型的默认 值为null。如here 中所述:
The solution is to use the default keyword, which will return
null
for reference types and zero for numeric value types.
关于c# - 在 C# 中确定类的 default() 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24936788/