public void assimilateWith(I_OpaView anotherView) { if (anotherView.viewType != viewType) { throw new ArgumentException("This instance is of type " + viewType.ToString() + " and cannot be assimilated with type " + anotherView.viewType.ToString()); } PropertyInfo[] props = this.GetType().GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo pi in props) { string[] propNameParts = pi.Name.Split('.'); string propName = ""; if (propNameParts.Length > 0) { propName = propNameParts[propNameParts.Length - 1]; } if (propName.StartsWith("boolProp_")) { pi.SetValue(this, anotherView.boolProperties[pi.Name], null); } else if (propName.StartsWith("intProp_")) { pi.SetValue(this, anotherView.intProperties[pi.Name], null); } else if (propName.StartsWith("strProp_")) { pi.SetValue(this, anotherView.stringProperties[pi.Name], null); } else if (propName.StartsWith("subViews_")) { pi.SetValue(this, anotherView.subViewsLists[pi.Name], null); } } this._viewID = anotherView.viewID; this._parentViewID = anotherView.parentViewID; afterAssimilating(); }
public void assimilateWith(I_OpaView anotherView) { if (anotherView.viewType != viewType ){ throw new ArgumentException("This instance is of type " + viewType.ToString() + " and cannot be assimilated with type " + anotherView.viewType.ToString() ); } PropertyInfo[] props = this.GetType().GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo pi in props) { string[] propNameParts = pi.Name.Split('.'); string propName = ""; if (propNameParts.Length > 0) { propName = propNameParts[propNameParts.Length - 1]; } if (propName.StartsWith("boolProp_")) { pi.SetValue(this, anotherView.boolProperties[pi.Name], null); } else if (propName.StartsWith("intProp_")) { pi.SetValue(this, anotherView.intProperties[pi.Name], null); } else if (propName.StartsWith("strProp_")) { pi.SetValue(this, anotherView.stringProperties[pi.Name], null); } else if (propName.StartsWith("subViews_")) { pi.SetValue(this, anotherView.subViewsLists[pi.Name], null); } } this._viewID = anotherView.viewID; this._parentViewID = anotherView.parentViewID; afterAssimilating(); }
public void assimilateWith(I_OpaView anotherView) { initFrom_I_OpaView(anotherView); }