这是因为VB
Nothing不直接等同于C#
null。
例如,在C#中,此代码将无法编译:
int i = null;
但是此VB.Net代码可以正常工作:
Dim i As Integer = Nothing
Nothing实际上,VB.Net 与C#的
default(T)表达式更接近。

这是因为VB
Nothing不直接等同于C#
null。
例如,在C#中,此代码将无法编译:
int i = null;
但是此VB.Net代码可以正常工作:
Dim i As Integer = Nothing
Nothing实际上,VB.Net 与C#的
default(T)表达式更接近。