为什么,为什么呢。

编程入门 行业动态 更新时间:2024-10-09 09:16:21
本文介绍了为什么,为什么呢。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我最近看到一些程序员使用 string s = String.Empty; 而不是传统的 string s ="" ;; 是否有任何合乎逻辑的原因或只是OOP势利? 问候<一些用它来提高可读性。 Frank Rizzo <无** @ none>在消息中写道 新闻:OB ************** @ TK2MSFTNGP15.phx.gbl ... 我见过最近一些程序员使用 string s = String.Empty; 而不是传统的 string s ="" ;; 是否有任何合乎逻辑的原因或只是OOP势利? 问候

弗兰克, 这是OOP势利,我全心全意地订阅它=) - - Nicholas Paldino [.NET / C#MVP] - mv*@spam.guard。 caspershouse " Frank Rizzo" <无** @ none>在消息中写道 新闻:OB ************** @ TK2MSFTNGP15.phx.gbl ...

我见过最近一些程序员使用 字符串s = String.Empty; 而不是传统的 字符串s ="" ;; 是否有任何合乎逻辑的原因或只是OOP势利?问候

" Frank Rizzo <无** @ none>在消息中写道 新闻: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> 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 "Frank Rizzo" <no**@none> 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> 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

更多推荐

为什么,为什么呢。

本文发布于:2023-05-28 00:46:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/308206.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:什么呢

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!