Skip to main content

RCS1014: Use explicitly/implicitly typed array

Properties

PropertyValue
Default Severitydisabled by default
Minimum language version-

Examples

Example #1

diagnostic.cs
var items = new[] { "a", B };
fix.cs
var items = new string[] { "a", B };

Configuration

info

Option roslynator_array_creation_type_style is required to be set for this analyzer to work.

.editorconfig
# Prefer explicitly/implicitly typed array
roslynator_array_creation_type_style = explicit|implicit|implicit_when_type_is_obvious

# Use collection expression for array/collection creation
roslynator_use_collection_expression = true|false

Applies to