更好的方法 [英] Better way

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

问题描述




我很好奇 - 哪个更好.NET使用的方法如果需要知道

对象是什么?


1:如果IsNothing(myobject)......




2.如果myobject什么都没有...


TIA

Steve

Hi

I''m curious - which is the better ".NET" method to use if needing to know if
an object is Nothing?

1: If IsNothing(myobject) ...

or

2. If myobject Is Nothing ...

TIA
Steve

推荐答案

" Steve Peterson" < SP ******* @ nospam.com> schrieb:
"Steve Peterson" <sp*******@nospam.com> schrieb:
我很好奇 - 哪个更好.NET如果需要知道
是否一个物体什么都没用的方法?

1:如果IsNothing(myobject)......



2.如果myobject什么都没有...
I''m curious - which is the better ".NET" method to use if needing to know
if an object is Nothing?

1: If IsNothing(myobject) ...

or

2. If myobject Is Nothing ...




我认为决定应该基于个人喜好。我更喜欢

后一个。


-

MS Herfried K. Wagner

MVP < URL:http://dotnet.mvps.org/>

VB< URL:http://classicvb.org/petition/>



I believe the decision should be based on personal preference. I prefer the
latter one.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


我也是。我最喜欢的部分就是我可以写的时候:


如果不是MyObject什么都没有...


拿你所有的英语老师:P


" Herfried K. Wagner [MVP]"写道:
Me too. My favorite part is when I can write:

If Not MyObject is Nothing ...

Take that all you english teachers :P

"Herfried K. Wagner [MVP]" wrote:
" Steve Peterson" < SP ******* @ nospam.com> schrieb:
"Steve Peterson" <sp*******@nospam.com> schrieb:
我很好奇 - 哪个更好.NET如果需要知道
是否一个物体什么都没用的方法?

1:如果IsNothing(myobject)......



2.如果myobject什么都没有...
I''m curious - which is the better ".NET" method to use if needing to know
if an object is Nothing?

1: If IsNothing(myobject) ...

or

2. If myobject Is Nothing ...



我认为决定应该基于个人喜好。我更喜欢
后者。

- MS Herfried K. Wagner
MVP< URL:http://dotnet.mvps.org/>
VB< URL:http://classicvb.org/petition/>



I believe the decision should be based on personal preference. I prefer the
latter one.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>



如果不是MyObject什么都没有...

把你所有的英语老师都拿走:P


这很酷:-)

但是现在很严重...我更喜欢IsNothing(myobject),因为它在我的

意见中更清楚,但正如其他人所说的更多是个人偏好

也许是因为我也在T-sql中编程了很多,其中使用了类似的语法

(isnull等等函数调用)我只是自动将它打扮成


问候


Michel Posseth [MCP]


" TrtnJohn" < Tr的****** @ discussions.microsoft.com>在消息中写道

news:61 ********************************** @ microsof t.com ......我也是。我最喜欢的部分是我什么时候可以写:

如果不是MyObject什么都没有...

把你所有的英语老师都拿走:P

; Herfried K. Wagner [MVP]"写道:
If Not MyObject is Nothing ...

Take that all you english teachers :P
this is cool :-)
but serious now ... i prefer IsNothing(myobject) as it is more clear in my
opinion , but as said by the others it is more a personal preference
maybe because i also program a lot in T-sql where simular syntax is used
( isnull etc etc function calls ) i just automaticly typ this in

regards

Michel Posseth [MCP]

"TrtnJohn" <Tr******@discussions.microsoft.com> wrote in message
news:61**********************************@microsof t.com... Me too. My favorite part is when I can write:

If Not MyObject is Nothing ...

Take that all you english teachers :P

"Herfried K. Wagner [MVP]" wrote:
" Steve Peterson" < SP ******* @ nospam.com> schrieb:
"Steve Peterson" <sp*******@nospam.com> schrieb:
>我很好奇 - 哪个更好.NET如果需要使用的方法
>知道
>如果一个物体什么都没有?
>
> 1:如果IsNothing(myobject)......
>
>或
>
> 2.如果myobject Is Nothing ...
> I''m curious - which is the better ".NET" method to use if needing to
> know
> if an object is Nothing?
>
> 1: If IsNothing(myobject) ...
>
> or
>
> 2. If myobject Is Nothing ...



我认为决定应该基于个人喜好。我更喜欢
后一个。

- MS Herfried K. Wagner
MVP< URL:http://dotnet.mvps。 org />
VB< URL:http://classicvb.org/petition/>



I believe the decision should be based on personal preference. I prefer
the
latter one.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>



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

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