Reflecting parameter name: abuse of C# lambda expressions or syntax brilliance? [closed]

I find that odd not so much because of the name, but because the lambda is unnecessary; it could use an anonymous-type and be more flexible: .Attributes(new { style = “width:100%”, @class=”foo”, blip=123 }); This is a pattern used in much of ASP.NET MVC (for example), and has other uses (a caveat, note also Ayende’s … Read more

ASP.NET MVC partial views: input name prefixes

You can extend Html helper class by this : using System.Web.Mvc.Html public static MvcHtmlString PartialFor<TModel, TProperty>(this HtmlHelper<TModel> helper, System.Linq.Expressions.Expression<Func<TModel, TProperty>> expression, string partialViewName) { string name = ExpressionHelper.GetExpressionText(expression); object model = ModelMetadata.FromLambdaExpression(expression, helper.ViewData).Model; var viewData = new ViewDataDictionary(helper.ViewData) { TemplateInfo = new System.Web.Mvc.TemplateInfo { HtmlFieldPrefix = name } }; return helper.Partial(partialViewName, model, viewData); } and … Read more