工具重构C#公共字段成性 [英] Tools for refactoring C# public fields into properties

查看:149
本文介绍了工具重构C#公共字段成性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多的使用公共字段C#代码,我想将它们转换为属性。

I have a lot of C# code that uses public fields, and I would like to convert them to properties.

我有ReSharper的,它会做他们彼此接着一个,但是这将需要永远。

I have Resharper, and it will do them one by one, but this will take forever.

有谁知道一个自动重构工具,可以帮助这一点的?

Does anyone know of an automated refactoring tool that can help with this?

推荐答案

ReSharper的确实非常快,可以使用Alt + PageDown键/ Alt + Enter键(默认按键绑定)。如果你是在第一场,ALT + PageDown键将跳转到下一个(因为它会包括包装公众领域建议重构)和Alt + Enter键将提示您包装在一个属性。

Resharper does it very quickly, using Alt+PageDown / ALt+Enter (with the default key bindings). If you are at the first field, Alt+PageDown will jump to the next one (since it'll include wrapping public fields as a suggested refactoring), and Alt+Enter will prompt you to wrap it in a property.

既然你很可能希望避免所有属性的完整毯包裹,这大概是最快的办法。这是相当快,这样做是为了一类,因为它跳跃正是你需要去...

Since you most likely want to avoid a full blanket wrapping of all properties, this is probably the quickest approach. It's quite fast to do this to a class, since it jumps exactly where you need to go...

这篇关于工具重构C#公共字段成性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆