public void Cast(object dobj, object bobj) { for (int i = 0; i < Properties.Count; i++) { DTBProperty dtb = Properties[i]; dtb.BProperty.Set(bobj, dtb.DProperty.Get(dobj)); } }
public DObjectToBObject(Type dtype, Type btype) { foreach (PropertyInfo pi in dtype.GetProperties(BindingFlags.Public | BindingFlags.Instance)) { PropertyInfo bpi = btype.GetProperty(pi.Name, BindingFlags.Public | BindingFlags.Instance); if (bpi != null && bpi.PropertyType == pi.PropertyType) { DTBProperty dtbp = new DTBProperty(); dtbp.DProperty = new PropertyHandler(pi); dtbp.BProperty = new PropertyHandler(bpi); Properties.Add(dtbp); } } }