title: How to get all Forms and User Controls in WinForms project?
body: <p>I have a WinForms project, using Visual Studio 2013, DotNet Framework 4.0. How can I get a list of all of my created Forms and User Controls in the project, preferably at runtime?</p>
  
  <p>EDIT: Thanks for your reply. SO for example, I want to get the FOrms and User Controls under the namespace "MyApp.Forms" and "MyApp.UserControls", how can I get the assemblies?
  Here's how I do it:</p>
  
  <pre><code>IEnumerable&lt;Assembly&gt; CurrentDomainAssemblies = AppDomain.CurrentDomain.GetAssemblies().Where(a =&gt; a.FullName.StartsWith("MyAppNamespace"));
          foreach (Assembly a in CurrentDomainAssemblies)
          {
              IEnumerable&lt;Type&gt; AssembliesTypes = a.GetTypes().Where(t =&gt; (typeof(Form).IsAssignableFrom(t) || typeof(UserControl).IsAssignableFrom(t)) &amp;&amp; t.IsClass);
              foreach (Type t in AssembliesTypes)
              {
                  if (t.FullName.Contains("Usercontrol"))
                  {
                      listUc.BeginUpdate();
                      listUc.Items.Add(t.Name);
                      listUc.EndUpdate();
                  }
                  if (t.FullName.Contains("Forms"))
                  {
                      listForm.BeginUpdate();
                      listForm.Items.Add(t.Name);
                      listForm.EndUpdate();
                  }
  </code></pre>
  
  <p>EDIT: This approach based on the namespace of Forms and User Controls. Is it posssible to get its filename, not its namespace?</p>