I'm trying to dynamically invoke a member on a specific type using CoreCLR, but the method Type.InvokeMember is not available when compiling against DNXCORE50. However, if I compile against DNX451 it works fine.
Below is a sample of how this can be achieved using DNX451, but how can I do the same in DNXCORE50?
using System;
using System.Reflection;
namespace InvokeMember
{
public class Program
{
public void Main(string[] args)
{
typeof (Program).InvokeMember("DoStuff", BindingFlags.InvokeMethod, null, new Program(), null);
}
public void DoStuff()
{
Console.WriteLine("Doing stuff");
}
}
}
GetTypeInfo()
. – Nonparticipating