string.IsNullOrEmpty() vs string.NotNullOrEmpty()

前端 未结 14 1107
遇见更好的自我
遇见更好的自我 2021-02-01 02:56

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

e.g.

if (!string.IsNullOrEmpty())
14条回答
  •  甜味超标
    2021-02-01 03:48

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

    1. It's not null and it's not empty
    2. It's not null or it is empty

提交回复
热议问题