当我遍历一个对象的属性并最终得到一个 PropertyInfo 时,我如何访问该对象的实际属性?
@foreach(var propertyInfo in Model.Entity.GetType().GetProperties()) {
if (propertyInfo.PropertyType != typeof(string) &&
propertyInfo.PropertyType.GetInterface(typeof(IEnumerable<>).Name) != null) {
<div>
@foreach(var item in propertyInfo/*Need Actual Property Here*/) {
@Html.Action("Edit", new { Id = item.Id, typeName = "Item" });
}
</div>;
}
}