null vs Nothing [英] null vs Nothing

查看:69
本文介绍了null vs Nothing的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

方法的帮助说它可能会返回null。


使用该方法的书中的示例检查了Nothing的返回。


什么是VB等效的null?


谢谢

Cal

解决方案

< blockquote> *" Cal" <交流**** @ REMOVEa-znet.com> scripsit:

方法的帮助说它可能会返回null。

使用该方法的书中的一个例子检查了Nothing的返回。

是什么VB等效于null?




如果本书是为C#编写的,是的。但是没什么可以用于价值

类型。


-

Herfried K. Wagner
MVP·VB Classic,VB.NET

< http://www.mvps.org/dotnet>


< http ://www.plig.net/nnq/nquote.html>


嗨Cal,


是。


问候,

Fergus


没有VB等价于null吗?
如果本书是为C#编写的,是的。但是没有什么也适用于价值类型。




不确定这意味着什么。以下是正确的吗?


这是否意味着我可以将对象变量设置为null或Nothing,

而整数变量可以设置为Nothing但是不要为了

将整数变量设置为与将其设置为零无关?


将对象变量设置为null意味着它不引用对象?

- Herfried K. Wagner
MVP·VB Classic,VB.NET
< http://www.mvps.org/dotnet>

< http://www.plig.net/nnq/nquote.html>



Help for a method says it may return null.

An example in a book using that method checked the return against Nothing.

Is Nothing the VB equivalent of null?

Thanks
Cal

解决方案

* "Cal" <ac****@REMOVEa-znet.com> scripsit:

Help for a method says it may return null.

An example in a book using that method checked the return against Nothing.

Is Nothing the VB equivalent of null?



If the book is written for C#, yes. But ''Nothing'' will work for value
types too.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>


Hi Cal,

Yes.

Regards,
Fergus


Is Nothing the VB equivalent of null?
If the book is written for C#, yes. But ''Nothing'' will work for value
types too.



Not sure what that means. Is the following correct?

Does it mean I can set an object variable to null or to Nothing,
while an integer variable can be set to Nothing but not to null
Is setting an integer variable to nothing the same as setting it to zero?

Setting an object variable to null means it does not reference an object?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>



这篇关于null vs Nothing的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆