foreach (PropertyInfo SourceProp in SourcePO.GetType().GetProperties())
{
if (SourceProp != null)
{
PropertyInfo TargetProp = TargetPO.GetType().GetProperty(SourceProp.Name.ToUpper());
if (TargetProp != null && TargetProp.CanWrite)
{
object SourcePropValue = SourceProp.GetValue(SourcePO, null);
TargetProp.SetValue(TargetPO, SourcePropValue, null);
}
}
}
Fill similar objects property by reflection
Leave a reply