title: Access to type T properties of IEnumerable<T> returned from a method called via reflection
body: <p>I have a .dll and a console app that uses the said .dll but doesn't reference directly,
  it loads it via reflection. The console app calls a method of a class inside the .dll.<br>
  The method signature is <code>IEnumerable&lt;Customer&gt; GetAll()</code>;</p>
  
  <p>In the .dll I have done this:</p>
  
  <pre><code>class CustomerRepository : ICustomerRepository
  {
      public IEnumerable&lt;Customer&gt; GetAll()
      {
          using (var db = new DB02Context())
          {
              List&lt;Customer&gt; list = new List&lt;Customer&gt;();
  
              // some queries to fill the list
  
              return list;
          }
      }
  }
  </code></pre>
  
  <p>In the Console app I've done this:</p>
  
  <pre><code>Assembly assembly = Assembly.LoadFrom(pathToMyDLL);
  Type t = assembly.GetType("MyDLL.Models.CustomerRepository");
  
  var methodInfo = t.GetMethod("GetAll");
  
  if(methodInfo == null)
      throw new Exception("The method doesn't exists");
  
  var customerRepository = Activator.CreateInstance(t);
  
  // Invoke the GetAll() method
  var customerList = methodInfo.Invoke(customerRepository, null);
  </code></pre>
  
  <p>Now the question is, since GetAll returns <code>IEnumerable&lt;Customer&gt;</code> and my console app
  doesn't "know" anything about MyDLL.dll (I don't reference it directly, so it doesn't knows the <code>Customer</code> type).</p>
  
  <p>How can I access to the Customer list in order to access Customer'a properties without having to make a reference to the .dll explicitly?</p>