Guest User

Untitled

a guest
May 1st, 2012
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. MVC Razor syntax: @ followed by HTML
  2. @Html.Tmpl(@<p>text to display</p>)
  3.  
  4. public static HelperResult Tmpl<TModel>( this HtmlHelper<TModel> html, Func<HtmlHelper<TModel>, HelperResult> template )
  5. {
  6. return new HelperResult( writer => template( html ).WriteTo( writer ) );
  7. }
  8.  
  9. public static HelperResult List<T>(this IEnumerable<T> items,
  10. Func<T, HelperResult> template) {
  11. return new HelperResult(writer => {
  12. foreach (var item in items) {
  13. template(item).WriteTo(writer);
  14. }
  15. });
  16. }
Advertisement
Add Comment
Please, Sign In to add comment