本文介绍了string =""或= string.Empty?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! string =""或者string = string.Empty? 应该是正确的方法吗? 萨米 解决方案 string str = string.Empty是正确且更有效的方式。 谢谢, string str = string.Empty是正确而有效的方式。 谢谢, 好​​吧,它们效率不高,因为它们都是字符串文字,但 代码更接近于意图。 如果你想要一个空字符串总是使用string.Empty,你知道 当你找到"时在你的代码中有一些你不小心被删除的东西或者你忘记放在那里的东西。 - G ?跑安德森 _____ http://www.guffa。 com 好​​吧,它们效率不高两个字符串文字,但 代码更接近于意图。 如果你想要一个空字符串时总是使用string.Empty,你知道 当你找到"时在你的代码中有一些你不小心被删除的东西或者你忘记放在那里的东西。 我被告知string.Empty不需要任何用户记忆,每次你引用"时都需要你使用了更多的用户内存 存储文字。 string = "" or string = string.Empty?should is the proper way?Sami 解决方案string str = string.Empty is the proper and more efficient way.Thanks,string str = string.Empty is the proper and more efficient way.Thanks,Well, it''s not more efficient as they are both string literals, but thecode more closely resembles the intention.If you always use string.Empty when you want an empty string, you knowthat when you find "" in your code there is something that youaccidentally removed or something that you forgot to put there.--G?ran Andersson_____ http://www.guffa.comWell, it''s not more efficient as they are both string literals, but thecode more closely resembles the intention.If you always use string.Empty when you want an empty string, you knowthat when you find "" in your code there is something that youaccidentally removed or something that you forgot to put there.I''ve been told that string.Empty does not require any user memory, andevery time you reference "" you use a little bit more user memory tostore the literal. 这篇关于string =""或= string.Empty?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-19 14:33