title: Read grades from Grades.txt file and save best grades to BestGrades.txt
body: <p>I need to read the best grades from the Grades.txt file and save the best grades of individual students in the BestGrades.txt file. Unfortunately I can only view student data on the console.
  Could someone help me?</p>
  <pre><code>using System;
  using System.IO;
  
  namespace Projekt
  {
      class Program
      {
          static void Main(string[] args)
          {
              int counter = 0;
              string line;
              System.IO.StreamReader file =
          new System.IO.StreamReader(@&quot;C:\Users\eryks\Desktop\Grades.txt&quot;);
  
              while ((line = file.ReadLine()) != null)
              {
                  System.Console.WriteLine(line);
                  counter++;
              }
  
              file.Close();
          }
      }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/vtSB6.png" rel="nofollow noreferrer">Console, and Grade.txt</a></p>
  <p>Grades.txt:</p>
  <pre><code>1,Jan,Kowalski,Informatyka,5
  2,Wiktoria,Prietz,Informatyka,6
  3,Jakub,Mateja,Informatyka,3
  id,name,lastname,school subject,grade
  </code></pre>