title: Sort List according to names in C# using Linq queries
body: <p>Here is where I get a new customer when the user saves the customer information. I have a List called allcustomers where I store the customer object. So I generate a list of customers on my summary list with all the customer information. But I want to be able to use linq query to sort the names alphabetically in the Listbox. Here is my code for that, it doesn't sort the names. Any suggestions?</p>
  
  <pre><code>List&lt;Customer&gt; allCustomers = new List&lt;Customers&gt;();
  
  private void saveCustomerBtn_Click_1(object sender, EventArgs e)
  {
      if (lNameTextBox.Text.Length &gt; 0 &amp;&amp; addressTextBox.Text.Length &gt; 0)
      {                
          Customer aCustomer = new Customer(lNameTextBox.Text, addressTextBox.Text, Convert.ToDouble(idTextBox.Text), aReservation);
          conCustLabel.Text = "Customer Information has been saved!";
  
          allCustomers.Add(aCustomer);
      }
      else
      {
          MessageBox.Show("No data has been entered, Please enter the information!");
      }
  }
  
  private void sNameBtn_Click(object sender, EventArgs e)
  {
      summaryListBox.Items.Clear();
  
      foreach (Customer aCustomer in allCustomers)
      {                
          var sortNames = from Customer in allCustomers
                          orderby Name ascending   
                          select Name;
  
          if (sortNames.Any())
          {
              summaryListBox.Items.Add(aCustomer.DisplayCustomers());
          }             
      }                    
  }
  </code></pre>