How can I create subclass at run-time to map some properties then cast it back to parent class?
<p>Consider this <code>People</code> class:</p>

<pre><code>public class People
{
    public virtual string Name { get; set; }    
    public virtual ushort Age { get; set; }
}
</code></pre>

<p>I have some third party implementations that can obtain people data but with a little variations. For example, I have a method that is able to retrieve data for <code>StrangePeople</code>:</p>

<pre><code>    public class StrangePeople
    {
        public string Name { get; set; }        
        public DateTime BirthDate { get; set; }
    }
    ...
    StrangePeople someone = GetData&lt;StrangePeople&gt;();
</code></pre>

<p>Due to the amount of classes and variations I trying to found a way to generate a runtime subclass of <code>People</code> that can translate the data so I can cast it back to <code>People</code> later. In other words, with minimum effort generate a subclass like this:</p>

<pre><code>public class StrangePeopleTranslator : People
{
    private ushort? _mAge = null;

    public override ushort Age
    {
        get
        {
            if (_mAge == null)
            {
                DateTime today = DateTime.Today;
                int age = today.Year - BirthDate.Year;
                if (BirthDate &gt; today.AddYears(-age)) age--;
                _mAge = age;
            }

            return _mAge.GetValueOrDefault();
        }
        set
        {
            _mAge = value;
        }
    }

    public DateTime BirthDate { get; set; }
}

...

People someoneElse = (People)GetData&lt;StrangePeopleTranslator&gt;();
</code></pre>

<p>Maybe the run-time subclass it's bit overkill... I don't know.</p>
