【发布时间】:2012-05-14 06:01:30
【问题描述】:
我的问题很简单。
我想为对象中所有的属性值运行。例如:
public class Product
{
public int ProductId {get;set;}
public string Name {get;set;}
public string Content {get;set;}
}
var obj = new Product();
var props = obj.GetType().GetProperties();
foreach(var prop in props)
{
@Html.LabelFor( ....... ) // Need to run for active property.
// such as @Html.LabelFor( x => prop )
}
我怎样才能做我想做的事?这种方式或其他方式,
【问题讨论】:
标签: asp.net-mvc reflection lambda