using System; using System.Reflection; public class Test { delegate T Param(params object[] args); static Param skipArg(Type type, string method, int ind, object value, Type[] types = null) { MethodInfo mi; if (types == null) mi = type.GetMethod(method); else mi = type.GetMethod(method, types); return delegate (object[] _args) { int len = _args.Length; object[] args = new object[len + 1]; Array.Copy(_args, 0, args, 0, ind); Array.Copy(_args, ind, args, 1 + ind, len - ind); args[ind] = value; return (T)mi.Invoke(null, args); }; } static void Main() { Param pow2_ = skipArg(typeof(Math), "Pow", 0, 2), pow_2 = skipArg(typeof(Math), "Pow", 1, 2); var hw = skipArg(typeof(Console), "WriteLine", 0, "Hellow world!", new Type[] { typeof(string) }); hw(); hw(); hw(); Console.WriteLine("2 ^ 3 = {0}", pow2_(3)); // 2 ^ 3 = 8 Console.WriteLine("3 ^ 2 = {0}", pow_2(3)); // 3 ^ 2 = 9 } }