.NET
1
Вклад в тег
public List<TreeViewNode> nodes = ...;
public List<Guid> GetAllParentsId(Guid Id)
{
List<Guid> response = new List<Guid>();
TreeViewNode current = nodes.FirstOrDefault(n => n.Id == Id);
if(current is null)
{
return response;
}
//response.Add(current);
var mynodes = GetAllParentsId(current.Id);
if(mynodes.Count == 0)
{
return response;
}
response.AddRange(mynodes);
return response;
}