I have enum lets say for example:
public enum Color
{
red,
green,
blue
}
And have two classes. which have property of enum.
public class ClassA
{
public Color Color{get;set;}
}
public class ClassB
{
[InvisibleFlag(Color.red)] // I want something like that
public Color Color{get;set;}
}
Now in Windows Forms Designer, I want to hide the red flag only from the Color enumeration for ClassB only.
I know that I can create a separated enum. but why duplicate values? I gave a simple example only.
Something I guess might help for superior who can help me at it.
Descriptor API. which I hate. ;(
Maybe something like TypeDescriptor.AddAttributes(object, new BrowsableAttribute(false));
This answer will not work in this case. I don't want to apply Browsable
attribute to the enum flags because it hides that flag in property grid for all classes. I want to be able to hide specific enum values for specific classes only, not for all classes.