How to perform a recursive search?

前端 未结 3 793
无人及你
无人及你 2020-12-24 11:03

I have a Task class which can have sub tasks of the same type

public class Task
{
  public DateTime Start { get; set;}
  public DateTime Finish { get; set;}
         


        
3条回答
  •  南方客
    南方客 (楼主)
    2020-12-24 11:58

    Separating iteration over tree from search may be beneficial if there are other tasks you want to do on all items. I.e. if you implement IEnumerable over the tree items you can use LINQ queries to search for anything you want or perform other operations on all tasks in you tree. Check out Implementing IEnumerable on a tree structure for a way to do so.

提交回复
热议问题