title: C# how to average a array input
body: <p>I Have the first part of my code pretty complete and I got the gist of the rest, I'm just not sure how to put it all together. Here is the first part</p>
  
  <pre><code>using System;
  namespace ConsoleApplication1
  {
      class Program
      {
          public class AccountInfo
          {
              public int Number { get; set; }
              public double Balance { get; set; }
              public string LastName { get; set; }
          }
  
          static void Main(string[] args)
          {
              List&lt;AccountInfo&gt; accounts = new List&lt;AccountInfo&gt;();
  
              for (int index = 1; index &lt; 6; index++)
              {
                  AccountInfo acc = new AccountInfo();
  
                  Console.Write("Enter account number: " + index.ToString() + ": ");
                  acc.Number = int.Parse(Console.ReadLine());
                  Console.Write("Enter the account balance: ");
                  acc.Balance = double.Parse(Console.ReadLine());
                  Console.Write("Enter the account holder last name: ");
                  acc.LastName = Console.ReadLine();
  
                  accounts.Add(acc);
              }
  
          }
      }
  }
  </code></pre>
  
  <p>The second part is to ask the user what they want to do with the arrays</p>
  
  <hr>
  
  <p>enter an a or A to search account numbers
  enter a b or B to average the accounts
  enter an x or X to exit program</p>
  
  <hr>
  
  <p>the search part I can use something like this:</p>
  
  <pre><code>public void search Accounts()
  {
      for(int x = 0; x &lt; validValues.Lenth; ++x)
      {
          if(acctsearched == validValues[x])
          {
              isValidItem = true;
              acctNumber = Number[x];
          }
          }
  </code></pre>
  
  <p>And I can use a while loop with a bool true/false to close out.</p>
  
  <p>I'm not sure how to get the average balance. I keep getting errors like "can't implicitly change int[] to int"</p>
  
  <p>Any help with this would very much appreciated.</p>