title: C# Sorting a list with an integer inside a struct
body: <p>Hello ive been sitting with this problem now for a training excersise while trying to learn C#. I'm making a list with 4 variabels and then trying to sort them after one of them, Sold.
  Im using a struct to make the list with the variabels and then use a while loop to fill it.
  I can get it to write out the list and its all there i just cant get it to sort.
  Ive tried using list.sort but i cant get it to accept the command. The struct is as follows.</p>
  
  <pre><code>Public struct Sale
  {
      public string Name;
      public decimal Personalnumber;
      public string District;
      public int Sold;
  }
  </code></pre>
  
  <p>And the list and while loop.</p>
  
  <pre><code>Console.WriteLine("Press Enter to start");
  Console.ReadLine();
  Sale[] saleslist = new Sale[8]; //skapar en lista
  
  int i = 0;
  
  while (i &lt; 8)
  {
      Console.WriteLine("Enter Name");
      saleslist[i].Name = Console.ReadLine(); //indata namn
      Console.WriteLine("Enter Personalnumber");
      saleslist[i].Personalnumber = decimal.Parse(Console.ReadLine());//indata personnummer
      Console.WriteLine("Enter District");
      saleslist[i].District = Console.ReadLine();//indata distrikt
      Console.WriteLine("Enter amount sold");
      saleslist[i].Sold = int.Parse(Console.ReadLine()); //indata antal sålda
      Console.WriteLine("Press Enter to continue to next person"); /* tryck enter för att gå vidare*/
      i++;
  }
  </code></pre>