环境:asp.net fx3.5
给定:
public class Product
{
public int ProductId { get; set; }
public string ProductName { get; set; }
public decimal UnitPrice { get; set; }
}
我有一个List<Product>
集合。
有没有办法获取属性名称,因为我希望它们成为我构建的csv文件的标题行?
所以我要的结果是一个string = "ProductId,ProductName,UnitPrice"