开发者

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

开发者 https://www.devze.com 2022-12-26 07:14 出处:网络
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.

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

精彩评论

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