title: Best practice to set large amount of properties in C# base class from derived class
body: <p>I'm working on refactoring some legacy code, and have a large set of data objects that share the same properties and fields.</p>
  
  <p>I'm also doing some reading on refactoring and at first glance it looks like I should use Extract Superclass. Is this a good idea when all I'm combining are properties? I mean they're really just fields with methods auto created so if we're talking about combining GetXYZ functionality that fits...?</p>
  
  <p>With that in mind, let's assume all my objects share 5 common properties:</p>
  
  <pre><code>public string Name { get; private set; }
  public string Status {get; private set; }
  public int IDNumber { get; private set; }
  public int LocationID { get; private set; }
  public Location LocationObj { get; private set; }
  </code></pre>
  
  <p>What's the best way to set these from the subclasses? Also I'll change the <strong>private set</strong> to <strong>protected set</strong>.</p>
  
  <p>1) Should I pass in the values/object and set the base class properties in each subclass constructor? This has some code duplication</p>
  
  <p>2) Pass in the parameters and have the derived class call the base class constructor?</p>
  
  <p>3) Create a protected method on the base class like SetBaseProperties? that takes all of them as parameters? (This seems a lot like #2 except a method vs ctor)</p>
  
  <p>Any other methods I'm not aware of?</p>