I have an extension method
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);
});
}
When I try to use this method like this
<ol>
@Model.List(t=> {@<li>@t.Title</li>});
</ol>
I get an error "; expected"
But if I do
<ol>
@Model.List( @<li>@item.Title</li>)
</ol>
it's OK. (what is the variable "item"? Where does it define?)
Why does the first example throws an error?