反射

反射

foreach (PropertyInfo prop in typeof(PetInfo).GetProperties())

{

    if (prop.CanRead && prop.CanWrite)

    {

        prop.SetValue(request, prop.GetValue(pet, null), null);

    }

}

result = request;

原文地址:https://www.cnblogs.com/huhunet/p/7402830.html