第一个if语句为什么会被判定为True呢?如果使用"is"而不是"=",它就不会被判定为True。如果将String.Empty替换为"Foo",它也不会被判定为True。因为String.Empty和"Foo"都属于同一类型的字符串,所以为什么一个被判定为True,另一个却不是呢?
//this evaluates to true
If Nothing = String.Empty Then
End If
//this evaluates to false
If Nothing = "Foo" Then
End If
.Equals()
方法进行比较? - AmberNothing=String.Empty
但是String.Empty != Nothing
。我刚刚发现了这个。 - dgo