ソリューションの核心は、リフレクションを使用して必要なメソッドを見つける必要があることです。これはあなたの状況をカバーする簡単な例です。
private string DoFormat(string data, string format)
{
MethodInfo mi = typeof (string).GetMethod(format, new Type[0]);
if (null == mi)
throw new Exception(String.Format("Could not find method with name '{0}'", format));
return mi.Invoke(data, null).ToString();
}
以下のように、メソッドをより汎用的にして、呼び出したいメソッドへの引数を受け入れることができます。必要な引数を渡すために .GetMethod と .Invoke を呼び出す方法が変更されていることに注意してください。
private static string DoFormat(string data, string format, object[] parameters)
{
Type[] parameterTypes = (from p in parameters select p.GetType()).ToArray();
MethodInfo mi = typeof(string).GetMethod(format, parameterTypes);
if (null == mi)
throw new Exception(String.Format("Could not find method with name '{0}'", format));
return mi.Invoke(data, parameters).ToString();
}