简体   繁体   English

将类中的所有属性更改为具有Resharper的支持属性

[英]Change All Properties In A Class To Have Backing Property With Resharper

I have a simple POCO with 12 properties. 我有一个具有12个属性的简单POCO。 I know that I can select a property, hit Alt-Enter and select "To property with backing field". 我知道我可以选择一个属性,单击Alt-Enter并选择“到具有后备字段的属性”。 Is there a way to automate this for every property in the class, or am I using the Resharper shortcut 12 times? 有没有一种方法可以针对班级中的每个属性自动执行此操作,或者我是否使用Resharper快捷方式12次?

Unfortunately, There is no option to for your case. 不幸的是,您的情况没有选择。 But, Resharper does provide options for applying quick-fixes on a wider scope. 但是,Resharper确实提供了在更大范围内应用快速修复的选项。

for example, If when you change variable's datatype to var, you may apply that change everywhere in file/project/solution, if you wish. 例如,如果在将变量的数据类型更改为var时,可以根据需要在文件/项目/解决方案中的任何位置应用该更改。

For a full list of quick fixes that can be applied on a wider scope. 有关可在更大范围内应用的快速修复的完整列表。 Please check http://www.jetbrains.com/resharper/webhelp/Code_Analysis__Fix_in_Scope.html 请检查http://www.jetbrains.com/resharper/webhelp/Code_Analysis__Fix_in_Scope.html

it's just a 12 times key pressing using keyboard shortcuts. 使用键盘快捷键仅需12次按键。

And in some scenarios Fody could be used: http://github.com/Fody/PropertyChanged 在某些情况下,可以使用Fody: http : //github.com/Fody/PropertyChanged

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM