GetAttribute

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>();

Description

get custom attribute helper

Details

Double click on the code to select all.

 

;