title: How to check how many times a number appears in a specific line inside a text file
body: <p>So this is my code so far. Its a mess I know, any ideas about how I can make it work?</p>
  
  <p>I want to output how many times a number appears inside a textfile. I want to get the numbers from a specific line inside the code that starts with the letter Time</p>
  
  <p>Count the total number of members across all 3 time slots</p>
  
  <p>The text file is like this:</p>
  
  <pre><code>*****************************
  Participant: 1
  
  Location: UK
  Name: George 
  Phone Number: 69347653633
  Time Slot: 1
  *****************************
  
  *****************************
  Participant: 2
  
  Location: FR
  Name: Alex 
  Phone Number: 69635343623
  Time Slot: 2
  *****************************
  
  *****************************
  Participant: 3
  
  Location: gr
  Name: Maria 
  Phone Number: 694785896
  Time Slot: 3
  *****************************
  </code></pre>
  
  <p>For example, I want an output like this:</p>
  
  <pre><code>Total Member Registered for Slot 1: 5
  
  Total Member Registered for Slot 2: 1
  
  Total Member Registered for Slot 3: 3
  </code></pre>
  
  <p>The numbers are in a range of 1 to 3</p>
  
  <p>The Output that i get so far is:</p>
  
  <pre><code>1 was found 1 times
  1 was found 1 times
  1 was found 1 times
  2 was found 1 times
  3 was found 1 times
  1 was found 1 times
  1 was found 1 times
  1 was found 1 times
  1 was found 1 times
  1 was found 1 times
  </code></pre>
  
  <p>Any ideas about how I can improve it and fix it?</p>
  
  <pre><code>public static void ReadNumbers()
  {
      // Declare list
      string[] lines = File.ReadAllLines("text.TXT");
  
      IEnumerable&lt;string&gt; selectLines = lines.Where(line =&gt; line.StartsWith("Time"));
  
      foreach (var item in selectLines)
      {
          var getNumbers = (from num in item where char.IsNumber(num) select num).ToArray();
  
          //Console.WriteLine(new string(getNumbers));
          getNumbers.ToArray();
  
          foreach (var group in getNumbers.GroupBy(n =&gt; n))
          {
              Console.WriteLine("{0} was found {1} times", group.Key, group.Count());
          }
      }
  }
  </code></pre>