private static ReflectionResult SetSimple(string property, object source, object value) { PropertyInfoResult info = AcquirePropertyInfo(property, source); if (info.ReflectionException != null) { return(new ReflectionResult { ReflectionException = info.ReflectionException }); } value = TypeConverter.To(value, info.PropertyInfo.PropertyType); try { info.PropertyInfo.SetValue(source, value, null); return(new ReflectionResult()); } catch (TargetInvocationException Te) { if (Te.InnerException != null) { throw Te.InnerException; } throw; } }
private static ReflectionResult GetSimple(string property, object source) { try { PropertyInfoResult info = AcquirePropertyInfo(property, source); if (info.ReflectionException != null) { return(new ReflectionResult { ReflectionException = info.ReflectionException }); } return(new ReflectionResult { Result = info.PropertyInfo.GetValue(source, null) }); } catch (TargetInvocationException TIe) { if (TIe.InnerException != null) { throw TIe.InnerException; } throw; } }