Depending on your needs another approach could be to use the BrowsableAttribute:
public class Product
{
[Browsable(false)]
public int ProId { get; set; }
public string ProName { get; set; }
public string Description { get; set; }
[Browsable(false)]
public decimal UnitPrice { get; set; }
}
Type t = typeof(Product);
PropertyInfo[] proInfo = t.GetProperties();
foreach (var pi in proInfo)
{
object [] att = pi.GetCustomAttributes(typeof(BrowsableAttribute), false);
if (att.Length > 0)
{
BrowsableAttribute b = att[0] as BrowsableAttribute;
if (b.Browsable)
{
Console.WriteLine(item.Name);
}
}
}