S2355 — Array literals should be used instead of array creation expressions

Language
VB.NET
Type
Code smell
Severity
Minor
Tags
clumsy

Why is this an issue?

Array literals are more compact than array creation expressions.

Noncompliant code example


Module Module1
    Sub Main()
        Dim foo = New String() {"a", "b", "c"} ' Noncompliant
    End Sub
End Module

Compliant solution


Module Module1
    Sub Main()
        Dim foo = {"a", "b", "c"}              ' Compliant
    End Sub
End Module

↑ Back to top