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並能解密輸出。怎麼我能做些那????