public static object InstanceServerInterface(Type type, List <Type> assemblyTypes) { var callback = Activator.CreateInstance(type); var field = callback.GetType() #if (NETSTANDARD1_6 || NETCOREAPP1_1) .GetTypeInfo() #endif .GetProperty("InvokedServerMethodAction"); field.SetValue(callback, new Action <object, MethodInfo, object[]>((t, method, param) => { InvokedServerMethodAction?.Invoke(t, method, param); }), null); var field2 = callback.GetType() #if (NETSTANDARD1_6 || NETCOREAPP1_1) .GetTypeInfo() #endif .GetProperty("InvokedServerMethodFunction"); field2.SetValue(callback, new Func <object, MethodInfo, object[], object>((t, method, param) => { return(InvokedServerMethodFunction?.Invoke(t, method, param)); }), null); return(callback); }
public static object InstanceServerInterface(Type type, List <Type> assemblyTypes) { object callback = Activator.CreateInstance(type); PropertyInfo field = callback.GetType() .GetPropertyInfo("InvokedServerMethodAction"); field.SetValue(callback, new Action <object, MethodInfo, Shared.Models.ParameterInfo[]>((t, method, param) => { InvokedServerMethodAction?.Invoke(t, method, param); }), null); PropertyInfo field2 = callback.GetType() .GetPropertyInfo("InvokedServerMethodFunction"); field2.SetValue(callback, new Func <object, MethodInfo, Shared.Models.ParameterInfo[], object>((t, method, param) => { return(InvokedServerMethodFunction?.Invoke(t, method, param)); }), null); return(callback); }