Skip to main content

Remove instantiation of a local variable

PropertyValue
IdRR0185
Applicable Syntaxlocal variable with a new object creation
Enabled by Default

Usage

Example #1

before.cs
var x = new object();
after.cs
object x = null;

Example #2

before.cs
var arr = new object[0];
after.cs
object[] arr = null;

Configuration

roslynator_refactoring.remove_instantiation_of_local_variable.enabled = true|false