title: Adding element to list with Lambda Expression
body: <p>In the groupBox control, there are four checkBox element and their tags' names are 1, 2, 3, 4. checkBox1, checkBox3 and checkBox4 are selected. Here is the screenshot:</p>
  
  <p><a href="https://i.stack.imgur.com/5eI85.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5eI85.jpg" alt="enter image description here"></a></p>
  
  <p>I want to add selected checkbox items' tag to List item.
  I tried like this:</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
      List&lt;int&gt; filter = new List&lt;int&gt;();
  
      var add_tags = groupBox1.Controls.OfType&lt;CheckBox&gt;().Where(cb =&gt; cb.Checked).ForEach(cbx =&gt; filter.Add(Convert.ToInt32(cbx.Tag)));
  
  }
  </code></pre>
  
  <p>But it returns error and I don't understand the error.</p>
  
  <p>Here is the screenshot:</p>
  
  <p><a href="https://i.stack.imgur.com/JNoEJ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JNoEJ.jpg" alt="enter image description here"></a></p>