fill property of base class asp.net c#

Fill base class property dynamical.
private static void FillBaseClass(Class1 source, class2 destination)
{
    Type type = source.GetType();
    FieldInfo[] myObjectFields = type.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);

    foreach (FieldInfo fi in myObjectFields)
    {
        fi.SetValue(destination, fi.GetValue(source));
    }
}

Ex:
class2 : class1
this function fill the data of the base class.
fill property of base class asp.net c# fill property of base class asp.net c# Reviewed by Bhaumik Patel on 3:36 AM Rating: 5