How to get metadata custom attributes?
问题 I have a class that defines data annotations at class level. The meta data class has custom attributes associated with it, along with the usual DisplayName, DisplayFormat etc. public class BaseMetaData { [DisplayName("Id")] public object Id { get; set; } [DisplayName("Selected")] [ExportItem(Exclude = true)] public object Selected { get; set; } } [MetadataType(typeof(BaseMetaData))] public class BaseViewModel { public int Id { get; set; } public bool Selected { get; set; } Given a type T ,