title: C# Winform How to iterate all panels children inside panel parent
body: <p>So I have a parent Panel called &quot;pl_parent&quot; and inside it, there's 3 panel children with names (from left - right) pl_child1, pl_child2, pl_child3.</p>
  <p>Im trying to iterate all panel children inside pl_parent when button1 is pressed (pl_child1, pl_child2, pl_child3) with the following code :</p>
  <pre><code>    private void btn_Click(object sender, EventArgs e)
      {
          foreach (Panel pan in pl_parent)
          {
  
          }
      }
  </code></pre>
  <p>But it doesn't work as expected and I get an error &quot;Error   CS1579  foreach statement cannot operate on variables of type 'Panel' because 'Panel' does not contain a public instance definition for 'GetEnumerator'&quot;</p>
  <p>Thank you!</p>
  <p><a href="https://i.stack.imgur.com/A2U4p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A2U4p.png" alt="enter image description here" /></a></p>