title: C# - How to find the average from the numbers given by the textbox
body: <p>I am pretty new on the programming field. I started learning C# and I have a problem.
  I need to find the average of the given numbers from textboxes.</p>
  <pre class="lang-cs prettyprint-override"><code>int wage1 = int.Parse(textBox_wage1.Text);
  int wage2 = int.Parse(textBox_wage2.Text);
  int wage3 = int.Parse(textBox_wage3.Text);
  int wage4 = int.Parse(textBox_wage4.Text);
  int wage5 = int.Parse(textBox_wage5.Text);
  int wage6 = int.Parse(textBox_wage6.Text);
  int wage7 = int.Parse(textBox_wage7.Text);
  var average = new int[] { wage1, wage2, wage3, wage4, wage5, wage6, wage7 };
  double AverageBruto = Queryable.Average(average.AsQueryable());
  lbl_AverageBruto.Text = &quot;Average: &quot; + AverageBruto;`
  </code></pre>
  <p>This works perfectly fine if the user has filled all 7 textboxes, but if they didn't fill at least one of them, it causes an error. can someone help me figure out how I can find the average if they fill only 3 or 4 of the textboxes? Thank you.</p>