public void SetTargetObject(object value) { try { var set = value; if (set != null && (value.Equals("NULL") || value.Equals("null"))) { set = null; } if (set != null) { set = Convert.ChangeType(value, TargetType); } ParentType.GetRuntimeProperty(TargetName).SetValue(ParentObject, set); } catch (InvalidCastException) { try { ParentType.GetRuntimeProperty(TargetName).SetValue(ParentObject, value); } catch (Exception) { // ignored } } catch (Exception) { // ignored } }
public object GetTargetObject() { try { var stripped = ReflectionMethods.StripIndexer(TargetName); return(ParentType.GetRuntimeProperty(stripped).GetValue(ParentObject)); } catch (Exception) { return(null); } }