Tag: get

类,结构或接口成员声明中的标记’=’无效c#

对于人们来说,这可能是一个简单的问题,但我不明白为什么会这样。 这是我的代码第1条: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GameCore { public class PlayerCharacter { public void Hit(int damage) { Health -= damage; if (Health <= 0) { IsDead = true; } } public int Health { get; private set; } = 100; public bool IsDead{ get; private set; } } […]