public pointCoord(pointCoord pre, string tabStr) { preCoord = pre; var tmp = tabStr.Split(';'); int count = tmp.Count() / 2; Type type = this.GetType(); //获取类型 for (int i = 0; i < count; i++) { System.Reflection.PropertyInfo propertyInfo = type.GetProperty(tmp[2 * i]); propertyInfo.SetValue(this, tmp[2 * i + 1], null); //给对应属性赋值 } if (tabStr.Contains("C")) { Cstate = true; } else { Cstate = false; } }
public pointCoord Offset(string offsetStr) { pointCoord offsetCooord = new pointCoord(this); var tmp = offsetStr.Split(';'); int count = tmp.Count() / 2; Type type = this.GetType(); //获取类型 for (int i = 0; i < count; i++) { System.Reflection.PropertyInfo propertyInfo = type.GetProperty(tmp[2 * i]); string basecoordStr = (string)propertyInfo.GetValue(this, null); //Convert it to double double offset = System.Convert.ToDouble(tmp[2 * i + 1]); double basecoord = System.Convert.ToDouble(basecoordStr); propertyInfo.SetValue(offsetCooord, (basecoord + offset).ToString(), null); //给对应属性赋值 } // offsetCooord.preCoord = this; return(offsetCooord); }
public pointCoord(pointCoord pre) { this.preCoord = pre; }
public pointCoord Offset(string offsetStr) { pointCoord offsetCooord = new pointCoord(this); var tmp = offsetStr.Split(';'); int count = tmp.Count() / 2; Type type = this.GetType(); //获取类型 for (int i = 0; i < count; i++) { System.Reflection.PropertyInfo propertyInfo = type.GetProperty(tmp[2 * i]); string basecoordStr = (string)propertyInfo.GetValue(this, null); //Convert it to double double offset = System.Convert.ToDouble(tmp[2 * i + 1]); double basecoord = System.Convert.ToDouble(basecoordStr); propertyInfo.SetValue(offsetCooord, (basecoord + offset).ToString(), null); //给对应属性赋值 } // offsetCooord.preCoord = this; return offsetCooord; }