Skip to main content

RCS1250: Use implicit/explicit object creation

Properties

PropertyValue
Default Severitydisabled by default
Minimum language version9.0

Examples

Example #1

diagnostic.cs
private string _value = new string(' ', 1)
fix.cs
private string _value = new(' ', 1)

Configuration

info

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

.editorconfig
# Prefer explicit/implicit object creation
roslynator_object_creation_type_style = explicit|implicit|implicit_when_type_is_obvious

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

# Use 'var' instead of implicit object creation
roslynator_use_var_instead_of_implicit_object_creation = true|false

Applies to