title: Implement List of Objects Using Dictionary Key/Value Pair
body: <p>I am trying to work with <code>Dictionary&lt;&gt;</code> along with <code>List&lt;&gt;</code> for searching purpose. I know, I can do this easily with <code>List&lt;&gt;</code> as follows:</p>
  
  <pre><code>var con = (from c in db.Customers
             where c.Status == status
             select c).ToList(); 
  </code></pre>
  
  <p>But preferred and tried to implement the above with <code>Dictionary&lt;&gt;</code>. My concept (We all know that) is using the key/value will increase the search option performance. This looks simple and stuck a bit. Here what I've tried:</p>
  
  <pre><code>static void Main(string[] args)
  {
     Dictionary&lt;string, Customer&gt; custDictionary = new Dictionary&lt;string, Customer&gt;(); //Dictionary declared
  
     List&lt;Customer&gt; lst = new List&lt;Customer&gt;(); //List of objects declared
  
     Customer aCustomer = new Customer(); //Customer object created
  
     /**Assign values - Starts**/
     aCustomer.CustomerId = 1001;
     aCustomer.CustomerName = "John";
     aCustomer.Address = "On Earth";
     aCustomer.Status = "Active";
  
     aCustomer.CustomerId = 1002;
     aCustomer.CustomerName = "James";
     aCustomer.Address = "On Earth";
     aCustomer.Status = "Inactive";
     /**Assign values - Ends**/
  
     custDictionary.Add(aCustomer.Status, aCustomer); //Added to the dictionary with key and value
  
     string status = Console.ReadLine().ToUpper();
  
     if (custDictionary.ContainsKey(status)) //If key found in the dictionary
     {
        Customer cust = custDictionary[status];
        Console.WriteLine(cust.CustomerId + " " + cust.CustomerName); //Outputs the final result - Right now no result found here
     }
  
    Console.ReadKey();
  }
  
  public class Customer
  {
     public int CustomerId { get; set; }
     public string CustomerName { get; set; }
     public string Address { get; set; }
     public string Status { get; set; }
  }  
  </code></pre>
  
  <p>Unfortunately, the above doesn't return any result. What I am trying is to get customer details by passing status key and again passed <code>Customer</code> object as the value. I am not sure what I am missing here.</p>
  
  <p>One more thing, in real-life projects, we get database results as list. So in this scenario, if <code>Dictionary&lt;&gt;</code> is used, I believe, the database results should be kept as follows:</p>
  
  <pre><code>lst.Add(aCustomer); //As database will have more result or data simply
  </code></pre>
  
  <p>On the other hand, I believe, the dictionary should look like the below:</p>
  
  <pre><code>Dictionary&lt;string, List&lt;Customer&gt;&gt; custDictionary = new Dictionary&lt;string, List&lt;Customer&gt;&gt;();
  </code></pre>
  
  <p>My question - Is it a good idea to pass a list of objects in the dictionary for the key/vale pair and I've tried using so. But didn't get the output yet.</p>
  
  <p><strong>Note</strong>: This sounds like a novice question and yes, it's. I've tried to search online and still studying it. I apology to ask such a question and would expect some answers if there are any better ways to do the above.   </p>