ambiguity between variables in C#

后端 未结 4 1793
无人及你
无人及你 2021-02-13 20:12

I want to start by saying I did search first, and found a lot of similar issues on various other things, but not this problem exactly.

I have this code:

         


        
4条回答
  •  执笔经年
    2021-02-13 20:27

    Name your private variable differently than your public one.

    bool _gameOver = false;
    
    public bool gameOver {
        get { return _gameOver; }
        set { _gameOver = value; }
    }
    

提交回复
热议问题