Beispiel #1
0
        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) });
            }
        }
Beispiel #2
0
 public static void SetPropertyWithArg <T, U>(PropertyInfo foundMember, T t, U value)
 {
     foundMember.SetValue(t, CustomConvert.ChangeType(value, foundMember.PropertyType), null);
 }
Beispiel #3
0
 public static void SetFieldWithArg <T, U>(FieldInfo foundMember, T t, U value)
 {
     foundMember.SetValue(t, CustomConvert.ChangeType(value, foundMember.FieldType));
 }