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

namespace DynamicType
{
    class Example4
    {
        // Listing 14-4
        public static object UseObjects(object a, object b)
        {
            Type aType = a.GetType();
            MethodInfo frob = aType.GetMethod("Frobnicate");
            frob.Invoke(a, null);

            MethodInfo add = aType.GetMethod("op_Addition",
                BindingFlags.Static | BindingFlags.Public, null,
                new[] { a.GetType(), b.GetType() }, null);
            return add.Invoke(null, new[] { a, b });
        }
    }
}
