title: How do you find only properties that have both a getter and setter?
body: <p>C#, .NET 3.5</p>
  
  <p>I am trying to get all of the properties of an object that have BOTH a getter and a setter for the instance.  The code I <em>thought</em> should work is </p>
  
  <pre><code>PropertyInfo[] infos = source.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetProperty | BindingFlags.GetProperty);
  </code></pre>
  
  <p>However, the results include a property that does not have a setter.  To give you a simple idea of my inheritance structure that might be affecting this (though I don't know how):</p>
  
  <pre><code>public interface IModel
  {
      string Name { get; }
  }
  
  public class BaseModel&lt;TType&gt; : IModel
  {
      public virtual string Name { get { return "Foo"; } }
  
      public void ReflectionCopyTo(TType target)
      {
          PropertyInfo[] infos = this.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetProperty | BindingFlags.GetProperty);
          foreach (PropertyInfo info in infos)
              info.SetValue(target, info.GetValue(this, null), null);
      }
  }
  
  public class Child : BaseModel&lt;Child&gt;
  {
      // I do nothing to override the Name property here
  }
  </code></pre>
  
  <p>I end up with the following error when working with Name:</p>
  
  <pre><code>System.ArgumentException: Property set method not found.
  </code></pre>
  
  <p>EDIT: I would like to know why this does <em>not</em> work, as well as what I should be doing to not get the error.</p>