feature request

1. Refactoring : Introduce constant

I think it will be usefule to make this refactoring for
code that has some hard-coded const strings.
It should replace selected string and all the same across currently
opened file and whole project.
Constants also can be placed into some selected class.

Also it would be nice for ReSharper offer replace "" to String.Empty and
give warning for it.

2 comments
Comment actions Permalink

I vote for this. It would be extremly usefull.
Also if you could automatically propose as constant name a capitalized
version of the string (maybe one with underscodes as well)
eg:
"UnderlyingMarketId" -> Introduce constant -> UNDERLYINGMARKETID or
UNDERLYING_MARKET_ID.

Thanks,
Corneliu




"Dymov Vlad" <twirpx@narod.ru> wrote in message
news:e3c5t2$ihs$1@is.intellij.net...

1. Refactoring : Introduce constant

>

I think it will be usefule to make this refactoring for
code that has some hard-coded const strings.
It should replace selected string and all the same across currently
opened file and whole project.
Constants also can be placed into some selected class.

>

Also it would be nice for ReSharper offer replace "" to String.Empty and
give warning for it.



0
Comment actions Permalink

Hello Vlad,

There are checkboxes that allow to make a constant in Introduce Variable
and Introduce Field refactorings. What benefits do you see in a separate
Introduce Constant refactoring?

1. Refactoring : Introduce constant

I think it will be usefule to make this refactoring for
code that has some hard-coded const strings.
It should replace selected string and all the same across currently
opened file and whole project.
Constants also can be placed into some selected class.
Also it would be nice for ReSharper offer replace "" to String.Empty
and give warning for it.

Thanks,
Andrey Simanovsky


0

Please sign in to leave a comment.