I want to write an expression that will retrieve a property within a property. My 2 classes:
public class BusinessType
{
public string Proprietor
{
get { return "Proprietor"; }
}
}
public class VendorApplicationViewModel
{
public List<BusinessType> BusinessClassification { get; set; }
}
public static IHtmlString RadioListForIEnum<TModel, TProperty>(this HtmlHelper<TModel> htmlhelper,
Expression<Func<TModel, TProperty>> expression)
{
var prop = ModelMetadata.FromLambdaExpression(expression, htmlhelper.ViewData);
//Func<TModel2, TProperty2> nestedProperty =
return null;
}
I'm rather lost as to how I can achieve this. Also I'm fairly new to expression trees any good recommendations on tutorials and the likes would be greatly appreciated. Thanks