title: GetCustomAttributes inherit parameter vs AttributeUsage.Inherited
body: <p>Why doesn't <a href="https://msdn.microsoft.com/en-us/library/kff8s254(v=vs.110).aspx" rel="nofollow noreferrer"><code>GetCustomAttributes(true)</code></a> return attributes where <a href="https://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&amp;l=EN-US&amp;k=k(System.AttributeUsageAttribute.Inherited);k(TargetFrameworkMoniker-.NETFramework,Version%3Dv4.6.1);k(DevLang-csharp)&amp;rd=true" rel="nofollow noreferrer"><code>AttributeUsageAttribute.Inherited = false</code></a>? There is nothing in the documentation that I can see that says that these two should interact. The following code outputs <code>0</code>.</p>
  
  <pre><code>class Program
  {
  
      [AttributeUsage(AttributeTargets.Class, Inherited = false)]
      class NotInheritedAttribute : Attribute { }
  
      [NotInherited]
      class A { }
  
      class B : A { }
  
      static void Main(string[] args)
      {
          var attCount = typeof(B).GetCustomAttributes(true).Count();
          Console.WriteLine(attCount);
      }
  }
  </code></pre>