Ejemplo n.º 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)));
        }
Ejemplo n.º 2
0
 public object?InvokeMethod(string method, object parameters)
 {
     return(TypeManipulations.GetMethodInfo(TypeOfObject, method, parameters)?.Invoke(ActualObject, TypeManipulations.ToObjectArray(parameters)) ?? null);
 }
Ejemplo n.º 3
0
        public object Initialise(object parameters)
        {
            Initialised = true;

            return(ActualObject = TypeOfObject.GetConstructors()[0].Invoke(TypeManipulations.ToObjectArray(parameters)));
        }