如何使用 ReSharper 将私有字段移动到类的顶部
我想将类中的所有私有字段移至顶部或至少移至它们聚集在一起的块。
有没有使用 ReSharper 快速实现这一目标的方法?
I want to move all the private fields in a class to the top or at least to a block where they are gathered together.
Is there any quick way to achieve this with ReSharper?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我回答了类似的问题这里。 它用于将它们放在底部,但也应该有足够的信息来帮助您进行设置。
I answered a similar question here. It's for putting them at the bottom, but should be enough information to get you set up too.
您需要名为“清理代码”的功能。
通过 CTRL+ALT+F 访问它。
确保您的个人资料中选择了对成员重新排序选项。 如果您想更改重新排序的工作方式,也可以,但这有点复杂。
您还可以通过右键单击解决方案资源管理器中的相应级别并从其中选择“清理代码...”选项,将其应用于整个项目或整个解决方案。
You want the feature called Cleanup Code.
You can access it via
Ensure that your profile has the option Reorder members selected. If you want to change the way that the reordering works, you can, but it's a little involved.
You can also apply this across an entire project or the entire solution by right-clicking at the appropriate level in solution explorer and choosing the Cleanup Code... option from there.
您是否尝试过“干净代码”选项?
我相信你可以在那里设置行为。
善良,
丹
Have you tried the Clean code options?
I believe you can set the behaviour there.
Kindness,
Dan