I seem to recall that CodeRush Classic instantiated objects/lists when using the 'Declare local' refactoring. With Coderush for Roslyn, declared objects are cast to a type, but are left null. I then have to go back and change the code to new up the object. Coderush has this behavior even when there is only a default constructor. For cases when there are multiple constructors, even if I had to pick the constructor (for something like List), doing so would save a lot of typing.
Example:
Codevar items = (List<string>)null;
MyMethod(items);
Hi Jonathan.
Thank you for informing us of this issue.
>I seem to recall that CodeRush Classic instantiated objects/lists when using the 'Declare local' refactoring.
> Coderush has this behavior even when there is only a default constructor.
I agree, the current behavior of "Declare local" should provide the capability to generate object creation (constructor call) as it was in CodeRush Classic.
We will improve it and notify you in the context of the current ticket.
> For cases when there are multiple constructors, even if I had to pick the constructor (for something like List), doing so would save a lot of typing.
Thank you for your suggestion, your idea does have merit.
I've created a separate ticket on your behalf: 'Declare local' refactoring should request a list of constructors. This issue will be addressed in the context of that ticket.