Change Int32 to int pattern

I am refactoring some legacy code and the previous developer used Int32 rather than int for variable assignments.  How would I create a pattern to change "Int32 myVar" to "int myVar".

Thanks

4 comments
Comment actions Permalink

Hello Brian
     You can use a 'Int32 $v$ = $expr$;' -> 'int $v$ = $expr$;' pattern where 'v' is an identifier placeholder and 'expr' is an expression placeholder. Let me know if this helps. Thank you!

Andrey Serebryansky

Software Developer

JetBrains, Inc

http://www.jetbrains.com

"Develop with pleasure!"

0
Comment actions Permalink

That works well when the declaration is in tge method but what about if it's an argurment to a method or a constructor?

0
Comment actions Permalink

Can you not just search and replace "Int32" to "int"?

0
Comment actions Permalink

I could, but then DataType.Int32 will get replaced or Convert.ToInt32 will get replaced.  The point is to leverage R# to do this for me.

0

Please sign in to leave a comment.