我的代码:
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; }
}
我将所有属性名称作为输出。但我不想在输出中显示 ProId 和 Decriction。我该怎么做????