Собственно сабж.
Возможно ли?
Здравствуйте, tanas80, Вы писали:
T>Собственно сабж.
T>Возможно ли?
using System;
using System.Reflection;
internal static class Program
{
private static int Method(int p1, ref int p2, out int p3) {
p2 += p1;
p3 = p1 * 3;
return p1 * 4;
}
private static void Main() {
const string MethodName = "Method";
const int ParametersCount = 3;
var types = new Type[ParametersCount] { typeof(int), typeof(int).MakeByRefType(), typeof(int).MakeByRefType(), };
var method = typeof(Program).GetMethod(MethodName, BindingFlags.NonPublic | BindingFlags.Static, null, types, null);
if(method == null) {
throw new InvalidOperationException("method == null");
}//if
var parameters = new object[ParametersCount] { 1, 2, null, };
var result = method.Invoke(null, parameters);
Console.WriteLine("Result: {3} = ({0}, {1}, {2})", parameters[0], parameters[1], parameters[2], result);
}
}