Is there a way to find all the properties of a given type without the BrowsableAttribute explicitly set to Yes in .Net?
I've tried the following code without success (all the properties which are browsable by default are also returned):
PropertyDescriptorCollection browsableProperties = TypeDescriptor.GetProperties(type, new Attribute[] { BrowsableAttribute.Yes });
A bit of reflection and linq will help here.
You can introduce a local variable to avoid calling
GetCustomAttribute
method twice.If you're in .Net framework version less than 4.5 you can write your own
GetCustomAttribute
extension method like this