internal static object[] SerializeParameters(IParameterConverter parameterConverter, MethodInfo targetMethod, object[] args) { var parameters = targetMethod.GetParameters(); var results = new List <object>(); for (var index = 0; index < parameters.Count(); index++) { var parameter = parameters[index]; var parameterValue = args[index]; results.Add(parameterConverter.ConvertToRemoteType(parameter.ParameterType, parameterValue)); } return(results.ToArray()); }
internal static object[] SerializeParameters(IParameterConverter parameterConverter, MethodInfo targetMethod, object[] args) { var parameters = targetMethod.GetParameters(); var results = new List <object>(); for (var index = 0; index < parameters.Count(); index++) { var parameter = parameters[index]; var parameterValue = args[index]; if (parameter.ParameterType.BaseType == typeof(System.MulticastDelegate)) { if (parameter.ParameterType.GenericTypeArguments.Any(g => g != typeof(EventArgs))) { throw new PriseProxyException($"Custom EventArgs are not supported in Prise"); } results.Add(parameterValue); continue; } object result = null; if (parameter.ParameterType.IsGenericParameter) { var runtimeType = parameterValue.GetType(); result = parameterConverter.ConvertToRemoteType(runtimeType, parameterValue); } else { result = parameterConverter.ConvertToRemoteType(parameter.ParameterType, parameterValue); } results.Add(result); } return(results.ToArray()); }