作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我知道我可以像这样设置 null
string val = null;
但我想知道我可以将其设置为 null 的其他方法。是否有像 String.null
这样的函数我可以使用。
最佳答案
我觉得你看得很远 String.Empty
string val = String.Empty;
更新: TheFuzzyGiggler评论值得一提:
It's much better to set a
string
toempty
rather thannull
. To avoid exceptions later. If you have to read and write a lot of strings you'll havenull
value exceptions all over the place. Or you'll have a ton ofif(!string.isNullorEmpty(string))
which get annoying
关于c# - 如何将字符串的值设置为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11193906/
我是一名优秀的程序员,十分优秀!