ReSharper
 
Get ReSharper
Get your hands on the new features ahead of the release by joining the Early Access Program for ReSharper 2025.1! Learn more

Code inspection: Redundant explicit size specification in array creation

Last modified: 08 April 2024

If you initialize an array by enumerating the values of its elements, there is no need to specify its size because the size is supplied by the number of elements in the array initializer.

ReSharper suggests a quick-fix that removes the explicit specification of the array size.