title: How to get list type elements using reflection in c#
body: <p>I have a class : Transaction.cs</p>
  
  <pre><code>public class Transaction
  {
      public int Transaction_id  { get; set; }
      public string Description { get; set; }
      public string Item { get; set; }
  }
  </code></pre>
  
  <p>I want too use reflection to get the values that are in the collection of transactions ie : </p>
  
  <pre><code>var db = new List&lt;Transaction&gt;();
  var temp = new Transaction { Transaction_id = 123, Item = "AKP", Description = "Startup" };
  var info = temp.GetType().GetProperties();
  db.Add(new Transaction { Transaction_id = 45, Item = "RW", Description = "Starting" });
  var type = typeof(Transaction);
  var prop = type.GetProperty("Item");
  var value = prop.GetValue(temp);
  </code></pre>
  
  <p>added this code for loop on properties: </p>
  
  <pre><code>foreach (var testing in db.GetType().GetProperties())
  {
      var sample = testing.GetValue(db);
      Console.WriteLine(sample);
  }
  </code></pre>
  
  <p>i get a value of 4 displayed in command line. </p>
  
  <p>which would give me the value of AKP on screen. Now how does it work when i have a list of transactions? </p>
  
  <p>Thanks</p>