How to avoid stack overflow errors when defining set accessor in C#

前端 未结 4 813
眼角桃花
眼角桃花 2021-01-18 19:45

People of stackoverflow. I am new to c# and this is the first time I have not been able to find an answer to one of my elementary questions. Who can help me?!I am trying to

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-18 20:27

    Because you're returning the same thing recursively.

    private string _headLine
    
    public string Headline
    { 
       get 
       { return _headline; } 
       set 
       { _headline = value; } 
    }
    

提交回复
热议问题