如何把一个接口的所有实现类反射出来

如题所述

你的意思是说在运行时得到类实现的接口么?利用反射可以实现这个目的.下面是示例程序,输出Int32所实现的接口:static void Main(string[] args) { Type classType = typeof(Int32); Type[] interfaces = classType.GetInterfaces();

foreach (Type eachType in interfaces) {

Console.WriteLine(eachType.ToString());
}
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答