title: How do I determine if a property was overridden?
body: <p>I am doing a project that where I need to register all the properties, because of the system being so huge it would require a lot of work to register all the properties that i want to be dependent for the purpose of Xaml.</p>
  
  <p>The goal is to find all properties that are on the top of the tree.</p>
  
  <p>so basically</p>
  
  <pre><code>public class A{
      public int Property1 { get; set; }
  }
  
  public class B : A{
      public int Property2 { get; set; }
      public virtual int Property3 { get; set; }
  }
  
  public class C : B{
      public override int Property3 { get; set; }
      public int Property4 { get; set; }
      public int Property5 { get; set; }
  }
  </code></pre>
  
  <p>The end result would be something like this</p>
  
  <pre><code>A.Property1  
  B.Property2  
  B.Property3  
  C.Property4  
  C.Property5  
  </code></pre>
  
  <p>If you notice I don't want to accept overridden properties because of the way I search for the properties if I do something like this</p>
  
  <p>C.Property3 for example and it cannot find it it will check C's basetype and there it will find it.</p>
  
  <p>This is what I have so far.</p>
  
  <pre><code>public static void RegisterType( Type type )
  {
      PropertyInfo[] properties = type.GetProperties( BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.GetProperty | BindingFlags.SetProperty );
  
      if ( properties != null &amp;&amp; properties.Length &gt; 0 )
      {
          foreach ( PropertyInfo property in properties )
          {
              // if the property is an indexers then we ignore them
              if ( property.Name == "Item" &amp;&amp; property.GetIndexParameters().Length &gt; 0 )
                  continue;
  
              // We don't want Arrays or Generic Property Types
              if ( (property.PropertyType.IsArray || property.PropertyType.IsGenericType) )
                  continue;
  
              // Register Property
          }
      }
  }
  </code></pre>
  
  <p>What I want are the following:  </p>
  
  <ul>
  <li>Public properties, that are <strong>not</strong> overridden, <strong>not</strong> static, <strong>not</strong> private</li>
  <li>Either get and set properties are allowed</li>
  <li>They are <strong>not</strong> an array or a generic type</li>
  <li>They are the top of the tree ie C class in the example is the highest (The property list example is exactly what I am looking for)</li>
  <li>They are <strong>not</strong> an indexer property ( this[index] )</li>
  </ul>