title: How to make a collection of values for same key in a dictionary object?
body: <p>I have an entity as under</p>
  
  <pre><code> public class ContextElements
  {
          public string Property { get; set; }
  
          public string Value { get; set; }
  }
  </code></pre>
  
  <p>Now I have populated the entity as under ( it is a simulation of the actual input which is coming from a web service) </p>
  
  <pre><code>var collection = new List&lt;ContextElements&gt;();
  
  collection.Add(new ContextElements { Property = "Culture", Value = "en-US" });
  
  collection.Add(new ContextElements { Property = "Affiliate", Value = "0" });
  
  collection.Add(new ContextElements { Property = "EmailAddress", Value = "sreetest@test.com" });
  
  collection.Add(new ContextElements { Property = "Culture", Value = "fr-FR" });
  
  collection.Add(new ContextElements { Property = "Affiliate", Value = "1" });
  
  collection.Add(new ContextElements { Property = "EmailAddress", Value = "somemail@test.com" });
  </code></pre>
  
  <p>Now I have a dictionary object as under</p>
  
  <pre><code>Dictionary&lt;string, List&lt;string&gt;&gt; dictStr = new Dictionary&lt;string, List&lt;string&gt;&gt;();
  </code></pre>
  
  <p>The output that I am looking for is that for every dictinct key (i.e. Property) e.g. "Culture","Affiliate","EmailAddress" here, the values will come in the List collection</p>
  
  <p>i.e. the final output of the dictionary will be the output of the below (obviously at runtime and programarically)</p>
  
  <pre><code>dictStr.Add("Culture", new List&lt;string&gt;() { "en-US", "fr-FR" });
  
  dictStr.Add("Affiliate", new List&lt;string&gt;() { "0","1" });
  
  dictStr.Add("EmailAddress", new List&lt;string&gt;() { "sreetest@test.com", "somemail@test.com" 
  });
  </code></pre>
  
  <p>Help needed</p>
  
  <p>Thanks</p>