Assume there is an attribute such as:
public class ValueAttribute : Attribute
{
public int Val;
public ValueAttribute(int val)
{
Val = val;
}
}
And it is applied to a class:
public class Person
{
[Value(10)]
public string FirstName;
[Value(20)]
public string LastName;
[Value(30)]
public string Age;
}
How would I go about efficiently retrieving a PropertyInfo
(preferably without loop/iteration) of the first occurrence of a property that has Value(20)
?
Aucun commentaire:
Enregistrer un commentaire