private void FillCustom(CustomElement custom, IExportElement data) { PropertyInfo[] props = data.GetType().GetProperties(); foreach (PropertyInfo prop in props) { PropertyInfo prop1 = custom.GetType().GetProperty(prop.Name); if (prop1 != null) { prop.SetValue(data, prop1.GetValue(custom), null); } } }
private void SetProperty(string propName, object value, CustomElement element) { try { PropertyInfo pro = element.GetType().GetProperty(propName); if (pro != null) { pro.SetValue(element, value, null); } } catch (Exception ex) { throw ex; } }