title: Elegant way to go from list of objects to dictionary with two of the properties
body: <p>i seem to write this code over and over again and wanted to see if there was a better way of doing it more generically.</p>
  
  <p>I start out with a list of Foo objects</p>
  
  <pre><code>Foo[] foos = GenerateFoos();
  </code></pre>
  
  <p>I think want to create a dictionary where the key and value are both properties of Foo</p>
  
  <p>for example:</p>
  
  <pre><code>Dictionary&lt;string, string&gt; fooDict = new Dictionary&lt;string, string&gt;():
  foreach (Foo foo in foos)
  {
      fooDict[foo.Name] = foo.StreetAddress;
  }
  </code></pre>
  
  <p>is there anyway of writing this code generically as it seems like a basic template where there is an array of objects, a key property a value property and a dictionary.</p>
  
  <p>Any suggestions?</p>
  
  <p><strong>I am using VS 2005 (C#, 2.0)</strong></p>