I have a custom school object that is part of the school family. Therefore, when I return to school, I can return the schools with which it is associated in my family.
However, when I do this, he manages to go in cycles forever, how can I stop him. As soon as 1 level of depth goes and does not become recursive?
public class School
{
public long BaseId { get; set; }
public string BaseName { get; set; }
public string SchoolFamily { get; set; }
public List<School> LinkedSchools
{
get
{
var schoolRepository = new SchoolRepository();
return schoolRepository.GetAllSchoolsLinkedByFamily(SchoolFamily).ToList();
}
set { ; }
}
}
source
share