你的意思是说在运行时得到类实现的接口么?利用反射可以实现这个目的。下面是示例程序,输出Int32所实现的接口:static void Main(string[] args) { Type classType = typeof(Int32); Type[] interfaces = classType.GetInterfaces();
foreach (Type eachType in interfaces) {
Console.WriteLine(eachType.ToString());
}
a XXXX=new a (); //XXXX是你要继承a类的类名XXXX.|A();
你只要继承a类,就能获得它所实现的方法和属性。