此代码有什么问题?我不断收到一个StackOverlflowException
..列表中的StackoverflowException
public class Places
{
public string Title { get; set; }
public string Content { get; set; }
public double Latitude { get; set; }
public double Longtitude { get; set; }
public List<Places> allPlaces = new List<Places>
{
new Places { Title = "test", Content = "test\ntest", Latitude = 52.23057, Longtitude = 5.84582 },
new Places { Title = "testt", Content = "dfsdf", Longtitude = 52.35589, Latitude = 4.92119 }
};
}
实例化allPlaces时有一个递归。 allPlaces在创建allPlaces时创建。 – Silvermind
感谢您的快速响应,但我不太明白。我该如何解决? – user3478148