Stack overflow exception thrown from overridden property from abstract base class

后端 未结 3 1849
深忆病人
深忆病人 2021-01-28 14:09

I have a base class with the following (trimmed for brevity) declaration:

public abstract class MyBaseClass
{    
  public int RecordId { get; private set; }
  p         


        
3条回答
  •  星月不相逢
    2021-01-28 14:48

    This is "By Design".

    In the setter of Status you are calling this.Status = value. Status is a virtual property and hence it will bind right back to the setter of MySpecificClass.Status.

    If you want to access the base property use base. instead

    base.Status = value;
    

提交回复
热议问题