我想调用从另一个类的类的方法之一。 的事情是,我不知道提前方法名,我把它从外部API ..
例子:
class A
public class Whichone
{
public static string AA() { return "11"; }
public static string BB() { return "22"; }
public static string DK() { return "95"; }
public static string ZQ() { return "51"; }
..............
}
class B
public class Main
{
........
........
........
string APIValue = API.ToString();
string WhichOneValue = [CALL(APIValue)];
}
让说的APIValue是BB然后WhichOneValue的值应该是莫名其妙22. 什么是正确的语法来做到这一点?
使用[反射](http://www.codeproject.com/Articles/17269/Reflection-in-C-Tutorial)。 – 2012-02-18 10:30:55