0
仅显示一些属性
我的代码:反射特性的信息:如何在运行时
namespace Reflection
{
class Program
{
static void Main(string[] args)
{
Type t = typeof(Product);
PropertyInfo[] proInfo = t.GetProperties();
foreach (var item in proInfo)
{
Console.WriteLine(item.Name);
}
}
}
public class Product
{
public int ProId { get; set; }
public string ProName { get; set; }
public string Description { get; set; }
public decimal UnitPrice { get; set; }
}
我得到的所有属性的名称作为output.But我不想显示ProId并能解密输出。怎么我能做些那????