csharpextensions icon indicating copy to clipboard operation
csharpextensions copied to clipboard

Initialize from parameter messes up method/constructor signature

Open abartho opened this issue 7 years ago • 0 comments

If a method signature or a constructor span multiple lines, and "Initialize ... from parameter" is executed for a parameter on the second or a subsequent line, the new field or property is generated within the method signature or constructor.

Example:

public void DoSomething(int par1,
   int par2)
{
}

Calling "Initialize field from parameter" on par2 results in:

public void DoSomething(int par1,
private readonly int par2;  //this is always generated one line above the parameter declaration
int par2)
{           
    this.par2 = par2;
}

abartho avatar Aug 13 '17 20:08 abartho