using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Examples5_13
{
    class Example11
    {
        public static object CreateAndInvokeMethod(
            string typeName, string member, params object[] args)
        {
            Type t = Type.GetType(typeName);
            object instance = Activator.CreateInstance(t);
            MethodInfo m = t.GetMethod(member);
            return m.Invoke(instance, args);
        }

    }
}
