IsNullOrEmpty与IsNullOrWhiteSpace性能比较
IsNullOrEmpty与IsNullOrWhiteSpace性能谁比较高呢?
在string都是空字符串的情况下:

IsNullOrWhiteSpace要比IsNullOrEmpty快大约 1~5倍左右
如果都是为null呢,谁比较快呢?

IsNullOrWhiteSpace稳定在3,而IsNullOrEmpty在1~12之间来回跳跃
如果有值呢,谁比较快?

IsNullOrWhiteSpace基本稳定在3左右,而IsNullOrEmpty跳动幅度比较大一些在3~50之间
测试代码如下:

如此看来IsNullOrWhiteSpace性能是要比IsNullOrEmpty高的多得多的。
但如果处理上万条,几十万条数据却是IsNullOrEmpty性能要高的。但是IsNullOrWhiteSpace相对比较稳定,IsNullOrEmpty跳动幅度比较大一些
IsNullOrEmpty与IsNullOrWhiteSpace性能比较的更多相关文章
- IsNullOrEmpty与IsNullOrWhiteSpace区别
IsNullOrEmpty public static bool IsNullOrEmpty(String value) { return (value == null || value.Length ...
- 【源码分析】你必须知道的string.IsNullOrEmpty && string.IsNullOrWhiteSpace
写在前面 之前自信撸码时踩了一次小坑,代码如下: private static void AppServer_NewMessageReceived(WebSocketSession session, ...
- IsNullOrEmpty和IsNullOrWhiteSpace的区别
IsNullOrEmpty // string /// <summary>Indicates whether the specified string is null or an < ...
- C# IsNullOrEmpty与IsNullOrWhiteSpace
IsNullOrEmpty:非空非NULL判断 IsNullOrWhiteSpace:非空非NULL非空格判断 后者优于前者 if (!string.IsNullOrWhiteSpace(valueE ...
- C#空值和null判断
一.空值判断效率 string s = ""; if(s == ""){} if(s == string.Empty){} if (string.IsNullO ...
- c#常用方法和类
1. 数据类型转换函数 Convert.ToXXX(); XXX.Parse(); XXX.TryParse(); 2. 日期相关的类与函数 获取系统当前日期(含时间):DateTime.Now 获 ...
- csharp: Setting the value of properties reflection
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- string类(二、常用string函数)
常用string相关,参至System.String类: 1/ string.Length a.Length字符串长度 string a="a5"; //a.Length==2 s ...
- 判断字符串为空 为null
str:string; delphi str.IsNullOrEmpty str.IsNullOrWhiteSpace TStringHelper for delphi only,c++ no use ...
随机推荐
- Ubuntu14.04安装配置星际译王词典
参考自:http://m.blog.csdn.net/blog/u014731529/25917149 平常总会遇到一些不认识的单词,汉字等等.一直使用Chrome 浏览器的翻译插件,不过插件的翻译总 ...
- 使用js动态添加组件
在文章开始之前,我想说两点 1 自己初学js,文章的内容在大神看来可能就是不值一提,但是谁都是从hello world来的,望高 手不吝指教# 2 我知道这个标题起的比较蛋疼,大家看图就能说明问题 ...
- ECMAScript 6 入门简介
ECMAScript 6.0(以下简称ES6)是JavaScript语言的下一代标准,已经在2015年6月正式发布了.它的目标,是使得JavaScript语言可以用来编写复杂的大型应用程序,成为企业级 ...
- Android图片加载库Fresco
在Android设备上面,快速高效的显示图片是极为重要的.过去的几年里,我们在如何高效的存储图像这方面遇到了很多问题.图片太大,但是手机的内存却很小.每一个像素的R.G.B和alpha通道总共要占用4 ...
- Css3盒子模型-css学习之旅(5)
主要内容: 盒子模型内边距,外边距,边框,外边距合并 主要包括:margin(外边距)padding(内边距) border(边框)centent(内容) 内边距:padding,paddinglef ...
- STL - string(典型操作demo)
1String概念 string是STL的字符串类型,通常用来表示字符串.而在使用string之前,字符串通常是用char*表示的.string与char*都可以用来表示字符串,那么二者有什么区别呢 ...
- Dynamics CRM ISV文件夹禁用后的解决方案
众所周知微软在CRM2011的12补丁后取消了对ISV文件夹的支持,那我们自定义开发的一些web应用或者是想部署个服务该怎么办,有的选择了另开一个站点发布.我们以服务为例这样的另开站点的发布方式会导致 ...
- 解决ADT大量出现"Unexpected value from nativeGetEnabledTags: 0"的问题
在过滤器中输入下面的代码即可:(此方法搜索于网略) ^(?!.*(nativeGetEnabledTags)).*$
- Cocos2D的OALSimpleAudio预加载音频
在OALSimpleAudio接口中,没有委托机制和通知机制告诉你什么时候预加载完成.也不需要这样的机制. 如下代码: //Listing 11-1. Preloading a background ...
- PHP 与搜索蜘蛛
本文移到:http://www.phpgay.com/Article/detail/classid/2/id/63.html