假设:
class BaseClass
{
public string MyProperty { get; set; }
public NestedClass_ NestedClass;
internal class NestedClass_ : BaseClass
{
public string MyNestedProperty { get; set; }
}
}
现在,让我们这样说:
var baseClass = new BaseClass();
baseClass.NestedClass.MyNestedProperty = "Value applied from nested class";
baseClass.MyProperty
更改时可以做些什么来应用相同的值baseClass.NestedClass.MyNestedProperty
吗?
而相反的情况呢:
var baseClass = new BaseClass();
baseClass.MyProperty = "Value applied from base class";
baseClass.NestedClass.MyNestedProperty
更改时可以做些什么来应用相同的值baseClass.MyProperty
吗?