title: Traversing a tree of objects in c#
body: <p>I have a tree that consists of several objects, where each object has a name (<code>string</code>), id (<code>int</code>) and possibly an array of children that are of the same type. How do I go through the entire tree and print out all of the ids and names?</p>
  
  <p>I'm new to programming and frankly, I'm having trouble wrapping my head around this because I don't know how many levels there are. Right now I'm using a <code>foreach</code> loop to fetch the parent objects directly below the root, but this means I cannot get the children.</p>