我对错误进行了一些研究,当设置器不断被调用时,我似乎在递归,但我真的不知道我做错了什么。我知道这可能也很简单。
namespace PracticeCSharp
{
class Program
{
static void Main(string[] args)
{
Player test = new Player();
test.Score = 5;
Console.ReadLine();
}
}
class Player
{
public int Score
{
get
{
return Score;
}
set
{
Score = value;
}
}
}
}
谢谢你的帮助。