问题描述
这是有原因的吗?我问是因为如果您需要使用大量空字符,那么您会遇到与使用大量空字符串时相同的情况.
Is there a reason for this? I am asking because if you needed to use lots of empty chars then you get into the same situation as you would when you use lots of empty strings.
这种用法的原因是这样的:
The reason for this usage was this:
myString.Replace ('c', '')
所以从 myString 中删除所有 'c' 的实例.
So remove all instances of 'c's from myString.
推荐答案
没有空字符这样的东西.您可以获得的最接近的是 ' ',即 Unicode空"字符.鉴于您可以将它嵌入到字符串文字中或非常容易地单独表达它,为什么您需要一个单独的字段呢?同样,很容易混淆 " 和 "" 参数不适用于 ' '.
There's no such thing as an empty char. The closest you can get is ' ', the Unicode "null" character. Given that you can embed that within string literals or express it on its own very easily, why would you want a separate field for it? Equally, the "it's easy to confuse "" and " "" arguments don't apply for ' '.
如果你能举例说明你想在哪里使用它以及为什么你认为它会更好,那可能会有所帮助......
If you could give an example of where you'd want to use it and why you think it would be better, that might help...
这篇关于为什么没有像 String.Empty 这样的 Char.Empty?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)