Exemple #1
0
        public object?InvokeMethod(string method, Type type, object parameters)
        {
            if (TypeManipulations.GetMethodInfo(TypeOfObject, method, parameters)?.ContainsGenericParameters ?? false)
            {
                var genericMethod = TypeManipulations.GetMethodInfo(TypeOfObject, method, parameters)?.MakeGenericMethod(new[] { type }) ?? null;

                return(genericMethod?.Invoke((TypeManipulations.GetMethodInfo(TypeOfObject, method, parameters)?.IsStatic ?? false) ? null : ActualObject, TypeManipulations.ToObjectArray(parameters)));
            }

            return(TypeManipulations.GetMethodInfo(TypeOfObject, method, parameters)?
                   .Invoke(ActualObject, TypeManipulations.ToObjectArray(parameters)));
        }
Exemple #2
0
 public object?InvokeMethod(string method, object parameters)
 {
     return(TypeManipulations.GetMethodInfo(TypeOfObject, method, parameters)?.Invoke(ActualObject, TypeManipulations.ToObjectArray(parameters)) ?? null);
 }
Exemple #3
0
 public object?InvokeMethod(string method)
 {
     return(TypeManipulations.GetMethodInfo(TypeOfObject, method, null)?.Invoke(ActualObject, null));
 }