【发布时间】:2009-05-14 05:53:02
【问题描述】:
我有一个我试图绑定到 DataGridView 的客户列表。我有两个看起来像这样的数据类:
public class Customer
{
public string Name { get; set; }
public AddressDetail Address { get; set; }
}
public class AddressDetail
{
public string StreetAddress { get; set; }
public string City { get; set; }
}
然后当我尝试填充 DataGridView 时,我使用:
CustomerInfo custInfo = new CustomerInfo();
CustomerGrid.DataSource = custInfo.GetCustomers();
GetCustomers 将返回一个客户列表。我的问题是地址列只有一列,并在列中显示“地址”。在 DataGridView 中为 Address 类的所有成员显示列的最佳方式是什么。
【问题讨论】:
标签: c# .net datagridview