开发者

Is it possible to move a property to another class with ReSharper?

开发者 https://www.devze.com 2022-12-21 14:18 出处:网络
I have a couple of properties and I want to collect them under a class to make my code more clean. Can I do this quickly with ReSharper?

I have a couple of properties and I want to collect them under a class to make my code more clean.

Can I do this quickly with ReSharper?

than开发者_高级运维ks


Move Static Member is Ctrl +R, O in ReSharper. They have a printable keymap which is also helpful before you learn them all (I still haven't...) You can find it here.


Nick Craver is right about the command being there, but I don't think you can ues it on a property unless it is a static property. The option is not available for normal properties for me. What you can do is first convert it to a static property, then move it, then convert it back to being non-static?

It could at least be a first step..


jamiebarrow is correct, you need to refactor to a static type first, see here:

http://www.jetbrains.com/resharper/webhelp/Refactorings__Move__Type_to_Another_Type.html


Yes, I believe that's one of the standard refactorings built into ReSparper and IntelliJ.


This one is quite tricky.

  1. Put the cursor above the field you want to move
  2. Press Ctrl+R O
0

精彩评论

暂无评论...
验证码 换一张
取 消