public static void SetMethodWithArg <T, U>(MethodInfo foundMember, T t, U value) { ParameterInfo[] paramInfo = foundMember.GetParameters(); if (paramInfo.Length == 0) { foundMember.Invoke(t, new object[] { }); } else { foundMember.Invoke(t, new object[] { CustomConvert.ChangeType(value, paramInfo[0].ParameterType) }); } }
public static void SetPropertyWithArg <T, U>(PropertyInfo foundMember, T t, U value) { foundMember.SetValue(t, CustomConvert.ChangeType(value, foundMember.PropertyType), null); }
public static void SetFieldWithArg <T, U>(FieldInfo foundMember, T t, U value) { foundMember.SetValue(t, CustomConvert.ChangeType(value, foundMember.FieldType)); }