title: Is Dictionary<TKey, TValue> faster than LINQ on a List<T>?
body: <p>I generally use <code>List&lt;T&gt;</code> for collections.
  But if I need a fast lookup on a collection, then e.g. in the following example I would use a Dictionary so I could look it up quickly by <code>id</code>:</p>
  
  <pre><code>Dictionary&lt;int, Customer&gt;
  </code></pre>
  
  <p><strong>But since I can use LINQ to query the <code>List&lt;T&gt;</code> anyway, as below, is there any reason to go through the trouble of using a Dictionary instead of a List?</strong> Is Dictionary faster or is LINQ doing something behind the scenes that makes it just as fast?</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace ConsoleApplication1
  {
      class Program
      {
          static void Main(string[] args)
          {
              List&lt;Customer&gt; customers = new List&lt;Customer&gt;()
              {
               new Customer { Id = 234, FirstName = "Jim", LastName = "Smith" },
               new Customer { Id = 345, FirstName = "John", LastName = "Thomas" },
               new Customer { Id = 654, FirstName = "Rick", LastName = "Ashton" },
               new Customer { Id = 948, FirstName = "Rod", LastName = "Anders" }
              };
  
              var customer = (from c in customers
                             where c.Id == 654 select c).SingleOrDefault();
              Console.WriteLine(customer.Display());
  
              Console.ReadLine();
  
          }
      }
  
  
      public class Customer
      {
          public int Id { get; set; }
          public string FirstName { get; set; }
          public string LastName { get; set; }
  
          internal string Display()
          {
              return String.Format("{0}, {1} ({2})", LastName, FirstName, Id);
          }
  
      }
  }
  </code></pre>