Tuesday, February 25, 2014

Problems with custom attributes on data members / properties

Hello,


Try this:



List<PropertyInfo> result =
typeof(MyDataClass)
.GetProperties()
.Where(
p =>
p.GetCustomAttributes(typeof(MyCustomAttribute), true)
.Where(ca => ((MyCustomAttribute)ca).UserAge)
.Any()
)
.ToList();





João Sousa (MCTS) Senior Software Engineer


No comments:

Post a Comment