可能重复:
如何获取具有给定属性的属性列表?
我有一个像这样的自定义类
public class ClassWithCustomAttributecs
{
[UseInReporte(Use=true)]
public int F1 { get; set; }
public string F2 { get; set; }
public bool F3 { get; set; }
public string F4 { get; set; }
}
我有一个自定义属性UseInReporte
:
[System.AttributeUsage(System.AttributeTargets.Property ,AllowMultiple = true)]
public class UseInReporte : System.Attribute
{
public bool Use;
public UseInReporte()
{
Use = false;
}
}
不,我想获取所有具有[UseInReporte(Use=true)]
如何使用反射来执行此操作的属性?
谢谢