deepsourcestatus / test-repository

Consider simplifying the element access CS-R1019
Anti-pattern
Major
8 months ago8 months old
Bracketed expression can be simplified
 33        var arr = new[] {1, 2, 3, 4, 5};
 34        // CS-R1019: `arr[arr.Length - 1]` can be rewritten as `arr[^1].`
 35        // https://deepsource.io/directory/analyzers/csharp/issues/CS-R1019
 36        var last = arr[arr.Length - 1]; 37
 38        var emptyString = string.Empty;
 39        // CS-R1014: Use `string.IsNullOrEmpty` or `string.IsNullOrWhiteSpace` to check for empty strings.