I have a custom attribute applied to some properties in a class. What is the most efficient way to retrieve a list of the properties that have the attribute applied? Do you have to reflect on the list of properties in the object and then query each one to see if the attribute is applied?
public class Reportable : Attribute
{
}
public class Report
{
[Reportable("WOID")]
public string ClientWOID { get; set; }
[Reportable("ClientName")]
public string ClientName { get; set; }
}
You will have to use reflection (so pretty much as you suspected):