title: C# Iterate through classes calling same function
body: <p>I have multiple classes, all residing in a distinct namespace. All classes derive from the same base class, all have the same function, accepting the same parameters. I would like to be able to iterate through the classes, calling said function.</p>
  <p>I know I can get a list of the classes using the following:</p>
  <pre><code>var validationClasses = Assembly.GetExecutingAssembly().GetTypes()
  .Where(t =&gt; t.Namespace == &quot;Panther.Business.Shipping.Validate&quot;)
  .ToList();
  </code></pre>
  <p>And, of course, I can iterate through each class in validationClasses.</p>
  <p>But I can’t figure out how to instantiate an instance of each class, and call that function.</p>
  <p>Any direction greatly appreciated.</p>