
Untitled
By: a guest on
May 1st, 2012 | syntax:
None | size: 0.52 KB | hits: 14 | expires: Never
MVC Razor syntax: @ followed by HTML
@Html.Tmpl(@<p>text to display</p>)
public static HelperResult Tmpl<TModel>( this HtmlHelper<TModel> html, Func<HtmlHelper<TModel>, HelperResult> template )
{
return new HelperResult( writer => template( html ).WriteTo( writer ) );
}
public static HelperResult List<T>(this IEnumerable<T> items,
Func<T, HelperResult> template) {
return new HelperResult(writer => {
foreach (var item in items) {
template(item).WriteTo(writer);
}
});
}