title: Get custom attributes across assemblies
body: <p>I have Assembly <code>A</code>, where <code>MyCustomAttribute</code> is located.</p>
  
  <p>Now I have Assembly <code>B</code>, where I have <code>reference</code> to assembly <code>A</code> and I use in assembly <code>B</code>  <code>MyCustomAttribute</code>.</p>
  
  <p>Now I want to get all inctanses of  <code>MyCustomAttribute</code> in Assebmly B.</p>
  
  <p>I try something like:</p>
  
  <pre><code>public static void Registration()
  {
      List&lt;MyCustomAttribute&gt; atrr = new List&lt;MyCustomAttribute&gt;();
  
      var assembly = System.Reflection.Assembly.GetCallingAssembly();
  
      var types = (from type in assembly.GetTypes()
                      where Attribute.IsDefined(type, typeof(MyCustomAttribute))
                      select type).ToList();
  }
  </code></pre>
  
  <p>And other ways -- but I can't get <code>MyCustomAttribute</code>.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>My attribute</p>
  
  <pre><code>namespace NamespaceOne.Attributes
  {
      [AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple = false,
      Inherited = false)]
      public class MyCustomAttribute: Attribute
      {
        ......
      }
  }
  
  Now the second Assembly(second project - ASP WebApi):
  
  namespace SecondNamespace.Controllers
  {
      public class HomeController : Controller
      {
  
          [MyCustomAttribute]
          public ActionResult Index()
          {
           MyStaticMethod.Registration(); // THIS Class andmethod in First class library - where located attribute 
              ViewBag.Title = "Home Page";
  
              return View();
          }
  </code></pre>