string.IsNullOrEmpty()与string.NotNullOrEmpty() [英] string.IsNullOrEmpty() vs string.NotNullOrEmpty()

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

问题描述

我很好奇,如果任何开发人员使用string.IsNullOrEmpty()通常多以消极比积极

I'm curious if any developers use string.IsNullOrEmpty() more often with a negative than with a positive

例如。

if (!string.IsNullOrEmpty())

这是我使用的方法99%的时间。什么是设计决定的呢?

This is how I use the method 99% of the time. What was the design decision for this?

推荐答案

由于IsNullOrEmpty更容易理解比NotNullOrEmpty。后者可能是PTED为跨$ P $:

Because "IsNullOrEmpty" is easier to understand than "NotNullOrEmpty". The latter could be interpreted as:

  1. 这不是空,它不是空的
  2. 这不是空或为空

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

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