title: Find all classes that derive from type and activate that type
body: <p>I have already looked at some similar answers but I cannot get it to work.</p>
  
  <p>I am attempting to make the following more maintainable:</p>
  
  <pre><code>var modules = new INinjectModule[]
  {
      new ServiceModule(),
      new ApplicationSettingsModule(),
      new SerializerModule(),
      new LoggerModule(),
      new SqliteModule(),
      new SetupModule(), 
      new CacheModule(), 
      new AuthenticationModule(), 
  };
  </code></pre>
  
  <p>Every time I add a new <code>NinjectModule</code> I need to modify this array to include it.</p>
  
  <p>I want to be able to find all types that derive from <code>NinjectModule</code> and activate them and put them all into a collection.</p>
  
  <p>This is what I have tried but I am not getting any of my classes that derive from <code>NinjectModule</code></p>
  
  <pre><code>var classes = (from domainAssembly in AppDomain.CurrentDomain.GetAssemblies()
                  from assemblyType in domainAssembly.GetTypes()
                  where typeof(NinjectModule).IsAssignableFrom(assemblyType)
                  select assemblyType).ToArray();
  </code></pre>
  
  <p>Please note that the classes that I want to find are in a different assembly... </p>