title: How get properties for a inherits class by this condition
body: <p>I have a <code>Person</code> class that inherits <code>PersonBase</code> and this second class inherits <code>EntityBase</code>:</p>
  
  <pre><code>public class Person : PersonBase
  {        
     virtual public string FirstName { get; set; }
     virtual public string LastName { get; set; } 
  }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>public class PersonBase : EntityBase
  {        
     virtual public string GroupName { get; set; }
  }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>public class EntityBase : IEntity
  {    
     public virtual long Id { get; protected set; }
     public virtual string Error { get; protected set; }
  }
  </code></pre>
  
  <p>I need to get list of properties of <code>Person</code> and <code>PersonBase</code> classes :</p>
  
  <pre><code>var entity = preUpdateEvent.Entity;
  
  foreach (var item in entity.GetType().GetProperties()) //only FirstName &amp; LastName &amp; GroupName
  {
     if (item.PropertyType == typeof(String))               
        item.SetValue(entity, "XXXXX" ,null);
  } 
  </code></pre>
  
  <p>Now <code>GetProperties()</code> is include : <code>FirstName, LastName, GroupName, Id, Error</code> but I need only own Person properties namely : <code>FirstName, LastName, GroupName</code></p>
  
  <p>Of Course I has been used below code but it is not suitable for me
   because it is only  include properties of <code>Person</code> class.</p>
  
  <pre><code>var properties = typeof(Person).GetProperties(BindingFlags.Public |
                                                    BindingFlags.Instance |
                                                    BindingFlags.DeclaredOnly);
  </code></pre>
  
  <p>How can I get the properties that are only defined on <code>Person</code> and <code>PersonBase</code> classes?</p>