GetAttribute
get custom attribute helper
Source
public static T GetAttribute<T>(this PropertyInfo pi) where T : Attribute
{
return pi.GetCustomAttributes(typeof (T), false).FirstOrDefault() as T;
}
Example
var attribute = PropertyInfoInstance.GetAttribute<XmlSerializationAttribute>();