title: Most efficient way to get all types in AppDomain marked with a specific attribute?
body: <p>If I do this, I enumerate over all types in my program:</p>
  
  <pre><code>List&lt;SerializableAttribute&gt; attributes=new List&lt;SerializableAttribute&gt;() ;
  foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
  {
      foreach (Type type in assembly.GetTypes())
      {
          attributes.AddRange(
                              type.GetCustomAttributes(false)
                              .OfType&lt;SerializableAttribute&gt;()
                              .ToList());
      }
  }
  </code></pre>
  
  <p>Is metadata that comes with a .NET dll indexed to allow me to do something like:</p>
  
  <pre><code>List&lt;SerializableAttribute&gt; attributes = typeof(SerializableAttribute)
                                           .GetClassesIAmDefinedOn();
  </code></pre>
  
  <p>Is there another option that I'm not considering?</p>
  
  <p>(SerializableAttribute is just an example)</p>