C # 的 IsNullOrEmpty

发布时间 2023-09-26 15:22:55作者: 流浪のwolf

作用:判断字符串是否是 null 或者 ”“ 如果是 null or ”“ 就返回 true 

IsNullOrEmpty是判断字符串的Null值和""值。如果字符串为空或为""都返回true。
string.IsNullOrEmpty(null)---返回true
string.IsNullOrEmpty("")---返回true

if (String.IsNullOrEmpty(”str“))
返回false,才表示str即不为空也不为""