title: C# Reflection - GetCustomAttributes for Type gets attribute from parent class
body: <p>Let's say I have two classes, the base class has a custom attribute:   </p>
  
  <pre><code>[MyAttribute]
  public class BaseModel
  {
      public string Id { get; set; }
  
      public string Name { get; set; }
  }
  
  public class InheritedModel : BaseModel
  {
      public string CompanyName { get; set; }
  
      public int Amount { get; set; }
  }
  </code></pre>
  
  <p>When I'm working with inherited class, like     </p>
  
  <pre><code>// member.DeclaringType is InheritedModel 
  
  if (member.DeclaringType.GetCustomAttributes(typeof(MyAttribute)).Any())
  {
     // returns true
  }
  </code></pre>
  
  <p>I expect this should be <code>false</code> because <code>InheritedModel</code> has not <code>MyAttribute</code> attribute directly.    </p>
  
  <p>It it correct behaviour? How can I divide parents and inheritors in condition above?</p>