[英]c#, refactor property to access private field to expression - bodied property
Given something like this给出这样的东西
public bool Hidden
{
get => _hidden;
private set => _hidden = value;
}
Or或者
public bool Hidden { get; private set; }
I would like to refactor the above so all set accessors of the Hidden property uses the _hidden field.我想重构上面的内容,以便 Hidden 属性的所有设置访问器都使用 _hidden 字段。 In other words the property should look like this afterwards:
换句话说,该属性之后应该如下所示:
public bool Hidden => _hidden;
and all accessors in the class should assign a value to the field _hidden.并且 class 中的所有访问器都应该为字段 _hidden 赋值。
But I dont know how to do this using Resharper?但我不知道如何使用 Resharper 做到这一点?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.