string.IsNullOrEmpty(串)与string.IsNullOrWhiteSpace(串) [英] string.IsNullOrEmpty(string) vs. string.IsNullOrWhiteSpace(string)

查看:301
本文介绍了string.IsNullOrEmpty(串)与string.IsNullOrWhiteSpace(串)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 string.IsNullOrEmpty(字符串)检查认为是不好的做法,一个字符串时,当有 string.IsNullOrWhiteSpace(字符串)在.NET 4.0及以上?

Is use of string.IsNullOrEmpty(string) when checking a string considered as bad practice when there is string.IsNullOrWhiteSpace(string) in .NET 4.0 and above?

推荐答案

他们不同的功能。你应该确定您的具体情况你需要什么。

They are different functions. You should decide for your situation what do you need.

我不考虑使用其中的任何一种不好的做法。大多数时候, IsNullOrEmpty()就足够了。但是你可以选择:)

I don't consider using any of them as a bad practice. Most of the time IsNullOrEmpty() is enough. But you have the choice :)

这篇关于string.IsNullOrEmpty(串)与string.IsNullOrWhiteSpace(串)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆