deepsourcestatus / test-repository

Use string.IsNullOrEmpty or string.IsNullOrWhiteSpace to check for empty strings CS-R1014
Anti-pattern
Major
8 months ago8 months old
Use string.IsNullOrWhiteSpace instead of comparing against empty string
 38        var emptyString = string.Empty;
 39        // CS-R1014: Use `string.IsNullOrEmpty` or `string.IsNullOrWhiteSpace` to check for empty strings.
 40        // https://deepsource.io/directory/analyzers/csharp/issues/CS-R1014
 41        if (emptyString == "") 42        {
 43            Console.WriteLine("String is empty!");
 44        }