C# で次のようなことを行う方法はありますか。
public class Class2 {
public string PropertyName1 { get
{
return this; //i mean "PropertyName1"
}
set {
this = value;
DoAdditionalFunction();
}
}
「セット」で追加の関数を呼び出す必要があるため、次のような追加のプライベート フィールドが必要です。
private string _propertyName1;
public string PropertyName1 { get
{
return _propertyName1;
}
set {
_propertyName1= value;
DoAdditionalFunction();
}
_propertyName1 のような追加のプロパティを使用したくありません。これを達成する方法またはベストプラクティスはありますか?