Depending on a preprocessor directive, I want to set all properties in a class to EditorBrowsableAttribute.Never.
I thought about creating a custom attribute, derived from EditorBrowsableAttribute, but unfortunately that class is sealed.
I’ve had a look at ICustomTypeDescriptor, but in the GetProperties method, I can get hold of each property descriptor, but the attributes collection is readonly.
Any ideas?
I happened across this issue again recently and this time the answer came to me very quickly; simply set up a couple of constants:
Then in your code, decorate a member like so: