GetChildForIDs(List<int> IDs)
{
List<int> IdsToReturn = new List<int>();
List<int> LIds = TableRepository.GetAll().where(x=>IDs.Contains(x.ID) & x.ID > 0).select(x=>x.LeftChild).ToList();
List<int> RIds = TableRepository.GetAll().where(x=>IDs.Contains(x.ID) & x.ID > 0).select(x=>x.RightChild).ToList();
IdsToReturn.AddRange(LIds);
IdsToReturn.AddRange(RIds);
if(IdsToReturn.Count()>0)
{
GetChildForIDs(IdsToReturn);
Count = Count + IdsToReturn.Count();
}
}
Now After Calling this method print Count Variable.You will get the count.