I do
System.Reflection.PropertyInfo[] prs =
MyControl.GetType().getProperties(BindingFlags.Public |
BindingFlags.Instance);
foreach (PropertyInfo pi in prs)
{
if IsBrowsable(pi)
{
...
}
}
public bool IsBrowsable(PropertyInfo p)
{
bool res;
res = true;
foreach (object att_loopVariable in p.GetCustomAttributes(true))
{
if (att_loopVariable is
System.ComponentModel.BrowsableAttribute)
{
System.ComponentModel.BrowsableAttribute att;
att =
(System.ComponentModel.BrowsableAttribute)att_loopVariable;
if (!(att as
System.ComponentModel.BrowsableAttribute).Browsable)
{
res = false;
}
}
}
return res;
}
*****
The above is not the exact match as I look at propertyGrid that attached to
MyControl.
1. Is the line System.Reflection.PropertyInfo[] prs =
MyControl.GetType().getProperties(BindingFlags.Public |
BindingFlags.Instance) correct ?
2. Is IsBrowsable correct?
What should I write in order to have the proper code.
Thanks