title: Vala. How do you delete all the children of a GTK container?
body: <p>Solved. See the reply for examples.</p>
  
  <p>I have a container with children. I need to delete all the children. This is easy in C. Vala does not work.</p>
  
  <p>The following code produces an error <em>missing type argument for collection</em>.</p>
  
  <pre><code>var a_box = new Box (Orientation.VERTICAL, 0);
  // Add some children
  List children = a_box.get_children();
  foreach (Widget element in children) { }
  </code></pre>
  
  <p>I tested over twenty variations of this code plus with many data types. When I do not get the missing type complaint, I end up with a data type that cannot be used as a widget which means I cannot destroy it.</p>
  
  <p>Using Vala, not C or Python or any of the many languages where this is easy, how do you remove all the children of a container?</p>
  
  <p>From what I can see, the only way to get the children is as a List but in Vala a List entry cannot be used to remove or destroy widgets.</p>
  
  <p>Both remove and destroy work in C. I have several C based applications doing both. The Vala 0.30 compiler rejected every translation from C to Vala and refused to compile examples from Valadocs etc.</p>