是否有任何方法可以自动应用C#7 Getter和Setter样式(或其他新语言功能)?
如果有任何方法可以自动更改此类属性:
public string MyProperty1
{
get
{
return this.myProperty1;
}
}
public string MyProperty2
{
get
{
return this.GetSomething();
}
set
{
this.SetSomething(value);
}
}
public string MyProperty3
{
get
{
return this.myProperty3;
}
set
{
this.myProperty3 = value;
this.RaisePropertyChange(nameof(MyProperty3));
}
}
:
public string MyProperty1 => this.myProperty1;
public string MyProperty2
{
get => this.GetSomething();
set => this.SetSomething(value);
}
public string MyProperty3
{
get => this.myProperty3;
set
{
this.myProperty3 = value;
this.RaisePropertyChange(nameof(MyProperty3));
}
}
也许有一个可以处理此任务的扩展名=)
提前感谢大家!
为此使用resmater。RESHARPER