日期:2014-05-18 浏览次数:21416 次
Type typeInterface = fileType.GetInterface("System.Collections.Generic.IList", true);
If (typeInterface==null)
return false;
else
return true;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
foreach (PropertyInfo pi in typeof(Program).GetProperties(BindingFlags.Instance | BindingFlags.Public))
{
if (Array.IndexOf(pi.PropertyType.GetInterfaces(), typeof(IList)) > -1)//查找实现了Ilist接口的属性
Console.WriteLine(pi.Name);
if (pi.PropertyType.IsGenericType)//如果该属性是泛型
{
foreach (Type t in pi.PropertyType.GetGenericArguments())//遍历输出属性的每个泛型参数类型
Console.WriteLine(t.FullName);
}
}
}
public List<int> Test { get { return new List<int>(); } }
}
}
------解决方案--------------------
关注一下