开发者

Can vs.net create public properties from private members using its Refactoring?

I have like 10 private members in my class, and I was hoping vs.net could create public properties from them but can't开发者_StackOverflow seem to find that option in VS.NET 2008.

Is there a feature for this?


In VS, select the field you want to create a property for. In the Refactor menu select Encapsulate Field... and in the Encapsulate Field dialog which appears enter the name for the property and click OK.

You'll have to do this for each field, but it's pretty quick (especially if you use shortcut keys).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜