例如,Dim aInt as Integer 的值应该为空而不是 0。
最佳答案
唯一的方法是使用 Nullable<T>
- 即(在 C# 中):
int? aInt; // defaults to null
常规整数没有 null
的概念/Nothing
.
关于c# - 如何将类型的默认值设置为 Nothing?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1707542/
例如,Dim aInt as Integer 的值应该为空而不是 0。
最佳答案
唯一的方法是使用 Nullable<T>
- 即(在 C# 中):
int? aInt; // defaults to null
常规整数没有 null
的概念/Nothing
.
关于c# - 如何将类型的默认值设置为 Nothing?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1707542/