So I have an Attribute
I have created like so:
public class IgnoreFilter : Attribute
{
}
and I have a class that I have used it on also like so:
public class Customer
{
private string name;
public string Name
{
get { return name; }
set
{
name = value;
RaisePropertyChanged();
}
}
private string address;
[IgnoreFilter]
public string Address
{
get { return address; }
set
{
address = value;
RaisePropertyChanged();
}
}
I am now trying to get all of the properties at runtime from my Customer
class that do not contain the IgnoreFilter
attribute. So far I have...
customer.GetType().GetRuntimeProperties().Where(p => !p.CustomAttributes.Contains(typeof(IgnoreFilter)));
But the last line doesnt compile. I think I am on the right lines but I am probably missing something.
Can someone help get properties from a class that do not contain a custom attribute?
Aucun commentaire:
Enregistrer un commentaire