title: Inputing a selection from an array c#
body: <p>Hi there I'm very new to C# so please bear with me if my question has a very obvious answer.</p>
  
  <p>I am trying to write a code that displays an array of options to the user with a number to select the option. The user then selects their option and the code will display their selection from the array. </p>
  
  <p>So for example </p>
  
  <pre><code>Select 1 for apples
  Select 2 for oranges
  Select 3 for pears
  
  Please Enter your Selection :
  </code></pre>
  
  <p>I keep typing a for loop to display my area but I cannot get my program to read the input from the array this is what I have so far </p>
  
  <pre><code>static void Main(string[] args) {
  
    string[] fruit = [3]
  
    fruit[0]=("apples");
    fruit[1]=("oranges");
    fruit[2]=("pears");
  
    for (int i = 0; i &lt; fruit.length; i++)
    {
      Console.WriteLine("Enter {0} to select {1}", i, fruit[i]);
    }
  
    string choice = Console.ReadLine();
    int i = int.Parse(choice);
    Console.WriteLine("You have selected {0} which is {1}", i, fruit[i]);
    Console.ReadLine();
  }
  </code></pre>
  
  <p>This gives me an error and if I place this within the for loop then the program does not display me all my options.</p>