My goal is to get class properties attribute and it's values.
For example, if I have an attribute 'Bindable' to check if property is bindable:
public class Bindable : Attribute
{
public bool IsBindable { get; set; }
}
And I have a Person class:
public class Person
{
[Bindable(IsBindable = true)]
public string FirstName { get; set; }
[Bindable(IsBindable = false)]
public string LastName { get; set; }
}
How can I get FirstName's and LastName's 'Bindable' attribute values?
public void Bind()
{
Person p = new Person();
if (FirstName property is Bindable)
p.FirstName = "";
if (LastName property is Bindable)
p.LastName = "";
}
Thanks.