title: How to sort a text file in alphabetical order using c#
body: <p>it prints all the names  from last name to fist in the text file but i am stuck trying to print it in alphabetical order by last name  </p>
  
  <p>here is the code i have so far: </p>
  
  <pre><code>namespace cse1302_Lecture18_FileIO_Prez
  {
      class Program
      {
          static void Main(string[] args)
          {
              StreamReader sr = new StreamReader("NameInput.txt");  //if file in bin/debug
  
              char[] delims = {','};
  
              //string[] names = {"",""};
  
              while(!sr.EndOfStream)
              {
                  string data_line = sr.ReadLine();
                  //names = data_line.Split(delims);
                  Console.WriteLine(data_line);
  
              }
              sr.Close();
          }
      }
  
  }
  </code></pre>