title: How to get value from IEnumerable collection using its Key?
body: <p>I have IEnumerable collection like following </p>
  
  <pre><code>IEnumerable&lt;Customer&gt; items = new Customer[] 
  { 
       new Customer { Name = "test1", Id = 999 }, 
       new Customer { Name = "test2", Id = 989 } 
  };
  </code></pre>
  
  <p>I want to get value using key <code>Id</code> </p>
  
  <p>I tried like following</p>
  
  <pre><code>public int GetValue(IEnumerable&lt;T&gt; items,string propertyName)
  {
        for (int i = 0; i &lt; items.Count(); i++)
        {
             (typeof(T).GetType().GetProperty(propertyName).GetValue(typeof(T), null));
             // I will pass propertyName as Id and want all Id propperty values 
             // from items collection one by one.
        }
  }
  </code></pre>