I cannot recall fully, but i believe in Coderush classic, Declare constant refactoring will replace all instances of a particular string in the file when applied.
But in Coderush Roslyn, only the particular instance on which the refactoring was applied changes.
C#{"Start Date", startDate.ToString("yyyyMMdd")},
{"End Date", endDate.ToString("yyyyMMdd")},
If i apply the refactoring by selecting the string for startDate, the endDate remains the same. I think Coderush classic used to replace all the occurences but dont have it installed anymore to check.
Hi Senthil,
You are absolutely right, CodeRush Classic replaces all occurrences in the file when you apply the "Declare Constant" refactoring.
We will add this behavior to CodeRush for Roslyn and notify you as soon as it is implemented.
Thanks. BTW, the behaviour is similar with the "Name can be simplifed" refactoring for types/namespaces too. Only the specific occurrence is replaced.
Models.ReportModel pReport = new Models.ReportModel();
The refactoring replaces the "Models." only on the LHS while the RHS is left as is.
Hello,
I've created a separate ticket on your behalf (The "Name can be simplified" refactoring replaces only a specific occurrence). It has been placed in our processing queue and will be answered shortly.