deepsourcestatus / test-repository

Explicit mention of array type and/or size is redundant when array is initialized CS-R1045
Anti-pattern
Major
8 months ago8 months old
Explicit declaration of array size and type is redundant
 69
 70        // CS-R1045: Explicit array size is redundant when initialized in place.
 71        // https://deepsource.io/directory/analyzers/csharp/issues/CS-R1045
 72        var odd = new int[] {1, 3, 5, 7, 9}; 73
 74        Foo? f = null;
 75        // CS-R1040: Null check can be collapsed and written as `f?.Bar == null`.