示例:string str;str="";str = null;str.Length=0;
三种看上去都可以用来判断字符串是否为空:
if(str == "") if(str == null) if(str.Length == 0) 这三种有什么区别,字符串在内存中是如何存在的?我知道有区别,但是忘了,所以有了此帖,高手给我讲下吧~~谢谢
三种看上去都可以用来判断字符串是否为空:
if(str == "") if(str == null) if(str.Length == 0) 这三种有什么区别,字符串在内存中是如何存在的?我知道有区别,但是忘了,所以有了此帖,高手给我讲下吧~~谢谢
string str = string.Empty;