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 ...
随机推荐
- Linux中的端口占用问题
本文将会阐述两种解决端口占用的方法. 本文会用到的服务器端的程序如下: #include "unp.h" #include <time.h> int main(int ...
- Java单例模式之饿汉模式与懒汉模式
单例模式是我们在开发软件的过程中经常用到的23中常用的java模式之一,主要的功能就是保证我们所使用的对象只有一个,这也在一方面减少了出错的可能性,增强了代码的健壮.单例模式一般来说有两种实现的方式, ...
- H5学习之旅-H5的表单(11)
H5的表单元素 form:表单 input:输入域,type属性可以设置text,password,button等不同的属性 textarea:文本域 lable:控制标签 fieldset:定义域 ...
- map.js的编写(js编写一个对象的方式)
// 定义map function Map() { this.container = {}; } // 将key-value放入map中 Map.prototype.put = function(ke ...
- 【Android 应用开发】Android屏幕适配解析 - 详解像素,设备独立像素,归一化密度,精确密度及各种资源对应的尺寸密度分辨率适配问题
. 作者 :万境绝尘 转载请注明出处 : http://blog.csdn.net/shulianghan/article/details/19698511 . 最近遇到了一系列的屏幕适配问题, 以及 ...
- 使用GDAL工具对FY3系列卫星数据进行校正
本文档主要对如何使用GDAL提供的工具对FY3系列卫星数据进行校正处理.FY3系列卫星提供的数据一般是以HDF5格式下发,一个典型的FY3A和FY3B的数据文件名如下: FY3A_MERSI_GBAL ...
- Linux System Programming --Chapter Seven
文件和目录管理 一.文件与其元数据 我们首先看一下一个简单的文本文件是怎么保存的: 打开vim,编辑一段文本: [root@localhost ~]# vim hello.txt 编辑内容如下: op ...
- Cocos2D v2.0至v3.x简洁转换指南(二)
触摸处理 我们在稍后将完成Cocos2d 3.0中触摸处理的完整教程.而现在最重要的是知道如何去启用触摸处理在你的CCNode中: self.userInteractionEnabled = TRUE ...
- Android不同系统版本依然能调用到正确的API方法Demo——Service调用startForeground举例
private static final Class<?>[] mSetForegroundSignature = new Class[] { boolean.class}; privat ...
- 从硬件竞争到软实力PK——电视媒体竞争观察
本文观点及数据摘自中广研究<三网融合月度精粹>第26期(2013年2月版),详细参考对应在线简版(http://doc.sarft.net/index.php?f=2013/02/2013 ...