== Why is this an issue? Using ``++string.Equals++`` to determine if a string is empty is significantly slower than using ``++string.IsNullOrEmpty()++`` or checking for ``++string.Length == 0++``. ``++string.IsNullOrEmpty()++`` is both clear and concise, and therefore preferred to laborious, error-prone, manual null- and emptiness-checking. === Noncompliant code example [source,csharp] ---- "".Equals(name); // Noncompliant !name.Equals(""); // Noncompliant name.Equals(string.Empty); // Noncompliant ---- === Compliant solution [source,csharp] ---- name != null && name.Length > 0 // Compliant but more error prone !string.IsNullOrEmpty(name) string.IsNullOrEmpty(name) ---- ifdef::env-github,rspecator-view[] ''' == Implementation Specification (visible only on this page) === Message Use "string.IsNullOrEmpty()" instead of comparing to empty string. ''' == Comments And Links (visible only on this page) === on 8 Jul 2015, 18:20:38 Ann Campbell wrote: FYI [~nicolas.peru]. In C#, this is a built-in function. Didn't know if you would want this rule since it requires a library in Java. === on 20 Jul 2015, 11:41:57 Tamas Vajk wrote: \[~ann.campbell.2] LGTM === on 22 Jul 2015, 07:15:37 Nicolas Peru wrote: \[~ann.campbell.2] Not applicable for java IMO. At least not until we provide some ways to suggest fix depending on what is in the classpath. endif::env-github,rspecator-view[]