更新时间:2023-10-14 15:32:52
在你想无论是在getter或无法使用自动属性了二传手的定制做任何事情。
I want to do this:
public Name
{
get;
set
{
dosomething();
??? = value
}
}
Is it possible to use the auto-generated private field?
Or is it required that I implement it this way:
private string name;
public string Name
{
get
{
return name;
}
set
{
dosomething();
name = value
}
}
Once you want to do anything custom in either the getter or the setter you cannot use auto properties anymore.