为什么,为什么呢。 [英] Why, oh why.
问题描述
我最近看到一些程序员使用
string s = String.Empty;
而不是传统的
string s ="" ;;
是否有任何合乎逻辑的原因或只是OOP势利?
问候<一些用它来提高可读性。
Frank Rizzo <无** @ none.com>在消息中写道
新闻:OB ************** @ TK2MSFTNGP15.phx.gbl ...
我见过最近一些程序员使用
string s = String.Empty;
而不是传统的
string s ="" ;;
是否有任何合乎逻辑的原因或只是OOP势利?
问候
弗兰克,
这是OOP势利,我全心全意地订阅它=)
-
- Nicholas Paldino [.NET / C#MVP]
- mv*@spam.guard。 caspershouse.com
" Frank Rizzo" <无** @ none.com>在消息中写道
新闻:OB ************** @ TK2MSFTNGP15.phx.gbl ...我见过最近一些程序员使用
字符串s = String.Empty;
而不是传统的
字符串s ="" ;;
是否有任何合乎逻辑的原因或只是OOP势利?
问候
" Frank Rizzo <无** @ none.com>在消息中写道
新闻:OB ************** @ TK2MSFTNGP15.phx.gbl ...我见过最近一些程序员使用
字符串s = String.Empty;
而不是传统的
字符串s ="" ;;
是否有任何合乎逻辑的原因或只是OOP势利?
问候
为什么要使用它?嗯,有时它比阅读''更难以阅读 &安培; String.Empty& "" ;.这只是一个原因......那里有
是其他人...但是如果你按照这些方式行,那么为了保持一致性,
String.Empty将是还有去的方式:)
这是势利的吗?当然可以......我知道我用它了
理由......势利......一句话:)
Mythran >
I''ve seen recently some programmers using
string s = String.Empty;
instead of traditional
string s = "";
Is there any logical reason for this or just OOP snobbery?
Regards
Some use it for better readability.
"Frank Rizzo" <no**@none.com> wrote in message
news:OB**************@TK2MSFTNGP15.phx.gbl...
I''ve seen recently some programmers using
string s = String.Empty;
instead of traditional
string s = "";
Is there any logical reason for this or just OOP snobbery?
Regards
Frank,
It''s OOP snobbery, and I whole-heartedly subscribe to it =)
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Frank Rizzo" <no**@none.com> wrote in message
news:OB**************@TK2MSFTNGP15.phx.gbl...I''ve seen recently some programmers using
string s = String.Empty;
instead of traditional
string s = "";
Is there any logical reason for this or just OOP snobbery?
Regards
"Frank Rizzo" <no**@none.com> wrote in message
news:OB**************@TK2MSFTNGP15.phx.gbl...I''ve seen recently some programmers using
string s = String.Empty;
instead of traditional
string s = "";
Is there any logical reason for this or just OOP snobbery?
Regards
Why use it? Well, sometimes it''s a little more difficult to read "''""''"
than it is to read "''" & String.Empty & "''". That''s just one reason...there
are others...but if you go along these lines, then for consistency,
String.Empty would be the way to go as well :)
Is it snobbery? Sure can be...I know I use it for that
reason...snobbery...what a word :)
Mythran
这篇关于为什么,为什么呢。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!