What is an elegant way to aggregate properties from subclasses in C#?
<p>I have a situation where I am mapping classes that have an inheritance hierarchy. I have a list of items that each class knows that it needs. For example:</p>

<pre><code>public class PersonMapper
{
 private string[] attributes = new[] {"firstName", "lastName"};
}

public class UserMapper : PersonMapper
{
 private string[] attributes = new[] {"username"};
}

public class EmployeeMapper : PersonMapper
{
 private string[] attributes = new[] {"employeeId"};
}
</code></pre>

<p>I would like to make a method call that returns the aggregate of all of the super classes like this:</p>

<pre><code>EmployeeMapper mapper = new EmployeeMapper();
string[] attributes = mapper.GetAttributes();
Assert.That(attributes, Has.Member("firstname"));
</code></pre>

<p>I can think of some solutions, but they seem overly complicated. I feel like there is an elegant solution to this that I am missing. Can anyone help?</p>

<p>Thanks in advance!</p>
