title: C#, Sorting a LINQ result alphabetically then, sort it according to Search Key
body: <p>I'm retrieving data from a database using Entity Framework.</p>
  
  <p>The result is filtered by a value entered in a Search TextBox.</p>
  
  <pre><code>var searchKey = this.TextBoxSearch.Text;
  
  var products = this.databaseManager.Products.Where(x =&gt; x.Name.Contains(searchKey)).Select(x =&gt; x.Name);
  </code></pre>
  
  <p>Then the the result is sorted alphabetically.</p>
  
  <pre><code>products = products.OrderBy(x =&gt; x);
  </code></pre>
  
  <p>Now I want to sort the result in a way that; Results containing the <strong>search key</strong> at their beginning come before those containing the <strong>search key</strong> somewhere else in  the text.</p>
  
  <p>Example:</p>
  
  <p>When the user types <strong>"iP"</strong>
  The filtered results should be as bellow :</p>
  
  <p>iPhone 4S, iPhone 5, All in one iP Phone ...... </p>
  
  <p>Of course in normal cases <strong>All in one iP phone</strong> is the first item in the list. because the results are sorted alphabetically. But in my case. the user's  <strong>search key</strong> must be dominant.</p>
  
  <p>Is this possible using C# Linq [.NET 4.5], Or in SQL Server ? if this can be done with an SQL query it's also good.</p>