string.IsNullOrEmpty大家应该都很熟悉,那么string.IsNullOrWhiteSpace就比string.IsNullOrEmpty多了一个判断的的内容,区别如下表:
| string.IsNullOrEmpty | string.IsNullOrWhiteSpace | ||
| 1 | null | 1 | null | 
| 2 | string.Empty | 2 | string.Empty | 
| 3 | "" | 3 | "" | 
| 4 | " " | ||
string.IsNullOrWhiteSpace就是可以判断" "里面仍然是空的字符串。
在工作中会更经常使用到string.IsNullOrWhiteSpace
学无止境,随手记记。
本文出自 “zhencoolgirl” 博客,请务必保留此出处http://zhencoolgirl.blog.51cto.com/12451952/1898835
随笔——string.IsNullOrEmpty和string.IsNullOrWhiteSpace的区别
原文:http://zhencoolgirl.blog.51cto.com/12451952/1898835