我有一個列表,ProductSpec {id, Name}
另一份爲Product {productspec, id, Name}
。 當我嘗試接入產品的性能到列表在列表的PropertyInfo獲取屬性迭代
IList<PropertyInfo> properties = typeof(Product).GetProperties().ToList();
我retreving我的ID和名稱這是很好的,但是當我嘗試重申一個productspec作爲
foreach(var property in properties)
{
IList<PropertyInfo> properties = property.propertytype.getproperties();
// I am not getting the productspec columns
//instead I am getting (capacity,count) as my properties..
}
所以,我該怎麼辦屬性從列表中重申列表來獲取列表屬性
這是什麼'property.propertytypr.getproperties()'? – V4Vendetta
對不起,我編輯我的問題,它應該是屬性類型 – Bhuvan
你能張貼'Product'和'ProductSpec'類的定義,以幫助我們更好地回答你的問題嗎? – jam40jeff