我需要一次又一次的事件。
例如,我想要这样的东西
public class ModelClass
{
public string Title { get; set; }
}OnBeforGet函数
public void OnBeforGet()
{
Title = "Value";
}使用助力
public void Test()
{
using (var modelClass = new ModelClass())
{
var title = modelClass.Title;
}
}发布于 2022-09-11 08:00:35
我想你是在找这样的东西。每次调用“Title”都会触发'OnBeforGet()‘函数
public class ModelClass
{
private string _title;
public string Title
{
get
{
OnBeforGet();
return _title;
}
set
{
this._title = value;
}
}
public void OnBeforGet()
{
Title = "value Updated Before Get function";
}
}https://stackoverflow.com/questions/73677393
复制相似问题