title: C# How to Get list of Ids from Parent-Child list
body: <p>I have a list of tasks containing parent-child relation. The relations keep getting changed. As the list structure is flat, i need to keep each task sorted, by DisplayOrder column.</p>
  
  <h2>Fields:</h2>
  
  <pre><code>TaskID - Title   -    ParentID  -  DisplayOrder
  1        A Task       Null      -     1
  2        B Task       Null            3
  3        C - A        1               2
  4        D - B        2               4
  </code></pre>
  
  <p>What I can imagine that after any relation is changed, I get all the tasks Ids in a way that each child ID is under its own Parent-ID and then update the DisplayOrder in of those IDs in their current sequence.</p>
  
  <p>But I am not sure how this is possible in c#. Please advise in this regard.</p>